Don't put title in a <link> tag


7th of January 2006

I learnt an important lesson today about the <link> tag. I had a XHTML Strict that looked like this:

 <link rel="stylesheet" type="text/css" media="print"
 
title="Design for print" href="/print.css" />

And every time I tried to print the page it did not correctly incorporate the print.css file. The file gets downloaded by the client but not incorporated. After a lot of trial and errors and testing I finally discovered why. The title attribute stops the link tag from working.

The correct way to declare a link tag for a media="print" is to do the following:

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

Hopefully this will help someone else getting into the same pickle as I was in.



Comment

Show all 3 comments
 
Name:
Email:
hide my email address.

Your email address will be encoded to prevent email-extraction spiders from reading it so you won't get spammed if you decide to show your email address.