View Full Version : linking to an external CSS file

08-31-2002, 09:39 AM
I read on W3.org that this is the proper way to link to an external CSS file in XML and XHTML, yet it does not seem to work.

<?xml-stylesheet href="css/test.css" type="text/css"?>
Should I stick with <link> ?

08-31-2002, 11:04 AM
don't know about XML, but on my XHTML pages I use either this:

<style type="text/css" media="all">@import "/style.css";</style>

or this:

<link rel="stylesheet" media="all" href="/style.css" type="text/css" />

to link to css files

08-31-2002, 03:10 PM
That is the correct way, and works fine in IE5+, Mozilla, and Opera.

08-31-2002, 05:45 PM
The <?xml-stylesheet?> processing instruction was intended to be only a temporary measure (though it appears to be still current).


Alex Vincent
09-01-2002, 09:34 PM
John, do you have a testpage you can show us?

The mime-type may be affecting it a great deal. For instance, an XHTML file served as text/html will not process stylesheets from <?xml-stylesheet ?>.

09-03-2002, 10:14 PM
Yeah I figured that out. .xml supports <?xml-stylesheet ?> where .htm wont