Choosing Text Elements
This chapter, jam-packed as it is with text elements, is a good opportunity for a reminder about the importance of well-structured and meaningful (semantic ) markup.
In the early years of web design, it was common to choose elements
based on their default formatting in the browser. Don’t like the size of
the h1
? Hey, use an h4
instead. Don’t like bullets on your list?
Make something list-like using br
elements. Need indents? Blockquote it! Those days are over and
gone.
Now we have Cascading Style Sheets (CSS) to visually format any
element any way we like, at last liberating us from the browsers’ default
rendering styles. That means you must choose elements that accurately
describe your content. If you don’t like how it looks, change it with a
style sheet. If you don’t see an HTML element that fits, use a generic div
or span
element to add appropriate structure and meaning.
Additional tips on good markup are listed in Chapter 8.
Get Web Design in a Nutshell, 3rd Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.