Helpful Information
Home
Categories
Contact us
Category: XML
linking to an external CSS file
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> ?
Hi,
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
That is the correct way, and works fine in IE5+, Mozilla, and Opera.
The <?xml-stylesheet?> processing instruction was intended to be only a temporary measure (though it appears to be still current).
patrick
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 ?>.
Yeah I figured that out. .xml supports <?xml-stylesheet ?> where .htm wont
privacy (GDPR)