HTML and CSS Reference
In-Depth Information
title="Special Projects">Special
<li><a href="contact.htm"
title="Send a Letter">Send a Letter</a></li>
It doesn't make sense to have a hyperlink that links to the page the user is currently
on, but at the same time, for semantic or styling purposes it may not make sense to re-
move the anchor element from the menu item in question. In the case of the City Press
web page, the href attribute is removed, and class="current" is added dynamic-
ally on the server side, which provides a CSS “hook” that can easily style the home link
differently from the rest of the menu ( Figure 3-9 ).
7 It's a good idea to explicitly include an anchor or identified element with an ID of “top“—some
browsers will infer such location.
Figure 3-9. The City Press menu, with the disabled Home link showing separate styling being ap-
plied through a class
HTML5 has added three new attributes to the a element, media , type , and down-
load , which specify, respectively, whether the link is optimized for display on a par-
ticular media/device; the MIME type of the linked resource ( image/jpeg , text/
html , and so on); and, finally, whether the link specifies a resource that is meant to be
downloaded. If the resource is meant to be downloaded, the value in the download
attribute is the default filename that is given to downloaded file. As of the time of this
writing, this attribute had only just appeared in the latest build of Google Chrome.
Search WWH ::

Custom Search