Prev | Current Page 226 | Next

Craig Grannell

"The Essential Guide to CSS and HTML Web Design"

Instead, you??™ll see a fragment
identifier, which is an anchor tag with a name attribute, but no href attribute. For instance,
a fragment identifier for the first answer is as follows:

Answer 1!


It??™s worth bearing in mind that the page only jumps directly to the linked element if
there??™s enough room underneath it. If the target element is at the bottom of the web
page, you??™ll see it plus a browser window height of content above.
USING LINKS AND CREATING NAVIGATION
153
5
The reason for the doubling up, here??”using both the name and id attributes, is because
the former is on borrowed time in web specifications, and it should therefore only be used
for backward compatibility.
Top-of-page links
Internal page links are sometimes used to create a top-of-page/back-to-top link. This is
particularly handy for websites that have lengthy pages??”when a user has scrolled to the
bottom of the page, they can click the link to return to the top of the document, which
usually houses the navigation. The problem here is that the most common internal linking
method??”targeting a link at #top??”fails in many browsers, including Firefox and Opera.
Back to top
You??™ve likely seen the previous sort of link countless times, but unless you??™re using Internet
Explorer or Safari, it??™s as dead as a dodo. There are various workarounds, though, one of
which is to include a fragment identifier at the top of the document.


Pages:
214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238