Prev | Current Page 227 | Next

Craig Grannell

"The Essential Guide to CSS and HTML Web Design"

At the foot of the
web page is the Back to top link shown previously, and the fragment identifier is placed
at the top of the web page:

This technique isn??™t without its problems, though. Some browsers ignore empty elements
such as this (some web designers therefore populate the element with a single space); it??™s
tricky to get the element right at the top of the page and not to interfere with subsequent
content; and, if you??™re working with XHTML Strict, it??™s not valid to have an inline element
on its own, outside of a block element, such as p or div.
Two potential solutions are on offer. The simplest is to link the top-of-page link to your
containing div??”the one within which your web page??™s content is housed. For sites I
create??”as you??™ll see in Chapter 7??”I typically house all content within a div that has an id
value of wrapper. This enables me to easily control the width of the layout, among other
things. In the context of this section of this chapter, the wrapper div also provides something
for a top-of-page link to jump to. Clicking the link in the following code block would
enable a user to jump to the top of the wrapper div, at (or very near to) the top of the
web page.
Top of page
Note that since standalone inline elements aren??™t valid in XHTML Strict, the preceding
would either be housed within a paragraph or a footer div, depending on the site.


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