Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   CSS - how to reference the CSS in a web page? (http://www.velocityreviews.com/forums/t385828-css-how-to-reference-the-css-in-a-web-page.html)

Dan Aldean 01-26-2007 10:38 PM

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



Dan Aldean 01-26-2007 11:58 PM

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?



senfo 01-27-2007 12:09 AM

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

thersitz 01-27-2007 12:19 AM

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
>




Dan Aldean 01-27-2007 12:47 AM

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




Dan Aldean 01-27-2007 12:49 AM

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
>




Dan Aldean 01-27-2007 12:51 AM

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



Alexey Smirnov 01-27-2007 10:09 AM

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



Dan Aldean 01-27-2007 02:33 PM

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.



Dan Aldean 01-27-2007 02:39 PM

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 12:16 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.