ptg16476052
Laying Out the Page 423
15
CSS-based layouts make it easier to maintain your HTML pages without cluttering them
up with
swapping in a new style sheet. Your web pages laid out with CSS will be smaller (and
thus load more quickly) than table-based pages. You can write web pages with the main
content first in the HTML source and the navigation and footer information after, making
your page friendlier to screen readers and search engines.
FIGURE 15.2
Table-based layout
can be very convo-
luted.
While it’s very important, as you’ve just learned, to not use tables
for layout, HTML5 has declared that it is still a valid use of the
tag. The important thing is to make it clear to browsers and user
agents that the table is used for layout. The best way to do this
is to include the role=presentation attribute on the table tag.
This attribute tells the browser explicitly that the table is intended
for layout.
NOTE
Writing HTML with Structure
The first step to laying out a page is to start with well-written HTML that is divided into
sections for styling. This is done with HTML5 structural elements you learned in Lesson
13, “Structuring a Page with HTML5,” that correspond to the different sections of the
page. If you have an area of the page that doesn’t fit with those elements, you can use the
tags to provide additional layout structure.