Don't put title in a <link> tag

07 January 2006   3 comments   Web development

Mind That Age!

This blog post is 12 years old! Most likely, its content is outdated. Especially if it's technical.

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.

Comments

kent
helvete vad tråkig sida. jag kräks. hoppas du hade en trvlig kinatrip. tjock.
Anonymous
Hi for me when i use this link tag, the url is printing when i gave print as follows.
<html>
<head>
<link rel=alternate media=print href="http://someserver/abc.doc">
</head>
<body onload=window.print()>
</body>
</html>
Lakshmi Ramya
Hi for me when i use this link tag, the url is printing when i gave print as follows.
<html>
<head>
<link rel=alternate media=print href="http://someserver/abc.doc">
</head>
<body onload=window.print()>
</body>
</html>

Your email will never ever be published


Related posts

Previous:
Ask Yahoo "What state do the Simpsons live in?" 05 January 2006
Next:
My new years resolution 2006 09 January 2006
Related by Keyword:
This site is now 100% inline CSS and no bytes are wasted 05 March 2013
mincss "Clears the junk out of your CSS" 21 January 2013
Tip: Printer friendly pages with Page Templates in Zope 24 March 2008
Printer usability problem 24 August 2007
CSS selector bug in IE? 05 December 2006
Related by Text:
Be very careful with your add_header in Nginx! You might make your site insecure 11 February 2018
jQuery and Highslide JS 08 January 2008
I'm back! Peterbe.com has been renewed 05 June 2005
Anti-McCain propaganda videos 12 August 2008
I'm Prolog 01 May 2007