Reading Jeff Atwood’s latest post reminded me of this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<body>
<a href='http://www.colourcoding.net/'><h1>
Can click on whitespace
</h1></a>
<h1><a href='http://www.colourcoding.net/'>
Can't click on whitespace
</a></h1>
</body>
</html>
This is actually a really useful technique, especially if you’re using a background image behind your title. You can click anywhere on the first line and it will follow the link. Is it portable? To the best of my knowledge every browser interprets this the same way. Is it standard?
Err… no. Actually, the standard doesn’t even allow you to put an h1 tag within an a tag. There are no other ways of doing this (we’ll ignore the possibility of using javascript to cloak it). I think I lost faith with validation at that point.
Technorati Tags: HTML,Web standards