![]() |
CSS - how to reference the CSS in a web page?
Hi,
I use ASP.NET 2.0 and I created a stylesheet, but I don't know how to make it visible to a web form "MyWebPage.aspx" that uses the master page. I put a reference to the css in the .master but it's not visible to the newly created page. MyWebPage.aspx doesn't have a <head> <link rel="stylesheet" type="text/css" href="mystyle.css" /> </head>structure. Thanks |
Re: CSS - how to reference the CSS in a web page?
MyWebPage starts with something like:
<%@ Page language="c#" Inherits="MyWebPage" CodeFile="MyWebPage.aspx.cs" MasterPageFile="Master.master" Title="This is my page"%> <asp:Content ID="Content1" runat="Server" but there is no <html> structure. Should the code in master page which includes the reference : <link rel="stylesheet" type="text/css" href="mystyle.css" /> be sufficient for MyWebPage to see the css document? |
Re: CSS - how to reference the CSS in a web page?
Dan Aldean wrote:
> Hi, > > I use ASP.NET 2.0 and I created a stylesheet, but I don't know how to make > it visible to a web form "MyWebPage.aspx" that uses the master page. I put a > reference to the css in the .master but it's not visible to the newly > created page. MyWebPage.aspx doesn't have a > <head> > <link rel="stylesheet" type="text/css" href="mystyle.css" /> > </head>structure. Use this, instead: <style type="text/css" media="all"> @import "mystyle.css"; </style> Afterwards, verify the rendered HTML to make certain that the path and everything are what you want. You don't have to do anything fancy to make CSS work in a master page. -- Sean website: http://senfo.blogspot.com |
Re: CSS - how to reference the CSS in a web page?
hey Dan
I am using css in my masterpages in the format you have below and they work just fine -- but then I am not using those style sheets on asp controls -- or atleast I haven't tried yet -- as I am new to aspNet -- tho I think it is doable. I'm just guessing here, but maybe it's yer doc type declaration that is causing the problem or your html tag if you have xlmns attribute. hey "Dan Aldean" <doruroman@rogers.com> wrote in message news:%23PyWqqZQHHA.3996@TK2MSFTNGP04.phx.gbl... > Hi, > > I use ASP.NET 2.0 and I created a stylesheet, but I don't know how to make > it visible to a web form "MyWebPage.aspx" that uses the master page. I put > a reference to the css in the .master but it's not visible to the newly > created page. MyWebPage.aspx doesn't have a > <head> > <link rel="stylesheet" type="text/css" href="mystyle.css" /> > </head>structure. > > Thanks > |
Re: CSS - how to reference the CSS in a web page?
Thank you for the reply.
Can you tell m please how I can verify the rendered HTML? Is it thru View Code? Unfortunately I cannot check the solution in .NET 2.0 until monday, as I have 1.0 at home. Where exactly can I use the <style> as I do not see any <HTML> structure? "senfo" <enceladus311@yahoo.comI-WANT-NO-SPAM> wrote in message news:%23EhIZdaQHHA.4260@TK2MSFTNGP06.phx.gbl... > Dan Aldean wrote: >> Hi, >> >> I use ASP.NET 2.0 and I created a stylesheet, but I don't know how to >> make it visible to a web form "MyWebPage.aspx" that uses the master page. >> I put a reference to the css in the .master but it's not visible to the >> newly created page. MyWebPage.aspx doesn't have a >> <head> >> <link rel="stylesheet" type="text/css" href="mystyle.css" /> >> </head>structure. > > Use this, instead: > > <style type="text/css" media="all"> > @import "mystyle.css"; > </style> > > Afterwards, verify the rendered HTML to make certain that the path and > everything are what you want. You don't have to do anything fancy to make > CSS work in a master page. > > -- > Sean > > website: http://senfo.blogspot.com |
Re: CSS - how to reference the CSS in a web page?
Thanks.
I need to use the css in the sever controls placed on the other form, not the master. "thersitz" <thersitz@gmail.com> wrote in message news:OydUBjaQHHA.1000@TK2MSFTNGP05.phx.gbl... > hey Dan > > I am using css in my masterpages in the format you have below and they > work just fine -- but then I am not using those style sheets on asp > controls -- or atleast I haven't tried yet -- as I am new to aspNet -- > tho I think it is doable. > > I'm just guessing here, but maybe it's yer doc type declaration that is > causing the problem or your html tag if you have xlmns attribute. > > hey > |
Re: CSS - how to reference the CSS in a web page?
One more thing, it's not the master page that I need to use the css against,
it's a page that uses the master page that has some server controls which I want to control from the style sheet |
Re: CSS - how to reference the CSS in a web page?
Among other things, master pages are designed to provide the overall
layout and design of an ASP.NET application at a single point (the ..master file) and reuse it in all content pages that derive from the master. Once you've defined CSS in the master page you can reuse this CSS across the entire site (and all controls in the content page derived from the master). On Jan 27, 1:51 am, "Dan Aldean" <doruro...@rogers.com> wrote: > One more thing, it's not the master page that I need to use the css against, > it's a page that uses the master page that has some server controls which I > want to control from the style sheet |
Re: CSS - how to reference the CSS in a web page?
Thank you. In fact the master page is inherited by the other pages, isn't
it? I tried this approach but for some reason it did not work. |
Re: CSS - how to reference the CSS in a web page?
But now another question pops into my mind: what do I do if I don't use a
master page? Where do I use <style type="text/css" media="all"> @import "mystyle.css"; </style> immediately after <%@ Page language="c#" Inherits="MyWebPage" CodeFile="MyWebPage.aspx.cs" MasterPageFile="Master.master" Title="This is my page"%> ? |
| All times are GMT. The time now is 02:47 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.