Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Including reference to external CSS file in ASPX not working


Message #1 by "Jose Romero" <jose.romero-lobo@c...> on Thu, 13 Jun 2002 21:43:33
Hi,

I'm developing an application in ASP.net. I wanted to have all my CSS code 
in a separate file to be included like this:

<HEAD>
....
<LINK rel="stylesheet" type="text/css" href=MyStyles.css>
</HEAD>

However, when the aspx file renders in IE6, the styles aren't applied. I 
know my styles are correct because if I copy them out of the MyStyles.css 
file and paste them into my aspx file inside of <STYLE> tags...they work.

Any ideas as to what may be wrong?

thanks,

Jose

ps. I've used <LINK> tags to include external style sheets into both HTML 
and ASP pages before....this is my first attempt on ASP.net
Message #2 by Feduke Cntr Charles R <FedukeCR@m...> on Fri, 14 Jun 2002 09:17:15 -0400
Jose,

	Is "MyStyles.css" located in the SAME directory as the page?  If
not, try to provide a path to it, starting with "/" if possible.  For
example:

href="/resources/MyStyles.css"

	The "/" will force the browser to make the request at the base level
directory (root), i.e. www.something.com/ <-- here.

	Also it is good practice to _ALWAYS_ surround every attribute with
double (or sometimes single) quotes, even if the attributes don't contain
any spaces or are numbers.  I don't understand why MS's code generators fail
to adhere to this very simple standard, but you should prevent yourself from
doing so.

- Chuck

-----Original Message-----
From: Jose Romero [mailto:jose.romero-lobo@c...]
Sent: Thursday, June 13, 2002 5:44 PM
To: ASP+
Subject: [aspx] Including reference to external CSS file in ASPX not
working


Hi,

I'm developing an application in ASP.net. I wanted to have all my CSS code 
in a separate file to be included like this:

<HEAD>
....
<LINK rel="stylesheet" type="text/css" href=MyStyles.css>
</HEAD>

However, when the aspx file renders in IE6, the styles aren't applied. I 
know my styles are correct because if I copy them out of the MyStyles.css 
file and paste them into my aspx file inside of <STYLE> tags...they work.

Any ideas as to what may be wrong?

thanks,

Jose

ps. I've used <LINK> tags to include external style sheets into both HTML 
and ASP pages before....this is my first attempt on ASP.net

  Return to Index