Free tech support / small logo


Getting external style sheets to link properly

A reader writes:
" On page 62 of Creating Cool HTML 4 Web Sites, the first line of code (<link type="text/css" href="mystyles.css" /> does not seem to work until I add 'rel=stylesheet'. I've tried it out on both IE 6.0 and Netscape 7.x."

Dave's Answer: You're absolutely correct!

Some of the newest browsers insist on having the link descriptor attribute rel included to confirm that it's a stylesheet you're pointing to.

Fortunately, it's pretty obvious if it isn't working and it's a very easy fix to get it working properly.

Here's an example of how to correctly include a stylesheet:

<link type="text/css" rel="stylesheet" href="mystyles.css" />
Hope that clears things up.

Note that you can always pop over to W3C (aka the World Wide Web Consortium) and read the official CSS specification documents, if you're so inclined.





Categorized: HTML and CSS   (Article 3724, Written by )
Tagged:
Previous: Monetizing site searches with Google WebSearch
Next: How do I do just incremental backups?




Subscribe!
Never miss another Q&A article! Click to subscribe: Add to Google Reader Add to My Yahoo! Subscribe in NewsGator RDF XML
Comments

hi,
is there a way to make a style sheet by os (MAC vs PC) and browser?

Posted by: Itamar at May 18, 2009 10:31 PM

I have something to say, now that you mention it, but ...
Starbucks coffee cup I do have a lot to say, and questions of my own for that matter, but first I'd like to say thank you for all your efforts on this Web site by buying you a cup of coffee!

I do have a comment, now that you mention it!











Remember personal info?


Please note that I will never send you any unsolicited email. Ever.

While I'm at it, please note that by submitting a question or comment you're agreeing to my terms of service, which are: you relinquish any subsequent rights of ownership to your material by submitting it on this site.









Recent Entries


Search
I Need Help!
Need Help? Ask Dave Taylor!


© 2002 - 2012 by Dave Taylor. All Rights Reserved.

Note: This web site is for the purpose of disseminating information for educational purposes, free of charge, for the benefit of all visitors. We take great care to provide quality information. However, we do not guarantee, and accept no legal liability whatsoever arising from or connected to, the accuracy, reliability, currency or completeness of any material contained on this web site or on any linked site.

[whiteboard marker tray]
"Ask Dave Taylor®" is a registered trademark of Intuitive Systems, LLC.