HTML and CSS Reference
Will you use Cascading Style Sheets, and if so, to what effect? You certainly
aren't required to use CSS, even after reading this entire book. You can create web-
sites that are usable, accessible, attractive, and effective without a single CSS prop-
erty anywhere in evidence. However, using CSS will make your site more flexible
and easier to maintain and will give you access to presentation effects you couldn't
get through HTML alone.
What “flavor” of HTML will you use? HTML5 has a lot of exciting new fea-
tures, but if you're concerned about older browsers that don't yet understand
HTML5, you may want to stick with XHTML.
Which browsers will you support? By “support,” I mean investing the effort to
work around the quirks of certain older browsers. There are a number of
workarounds for these temperamental browsers, plus ways to exclude certain
browsers from viewing styles. But if you are designing just for CSS-enabled
browsers, such as recent Firefox, Safari, or Opera versions, those workarounds
become less important.
Are you using positioning CSS for layout? It's relatively easy to use CSS for for-
matting text, controlling fonts, and setting colors. Using it for layout is trickier,
especially with inconsistent browser support among some of the older versions.
Will you use embedded or linked style sheets? Here, I'll give you advice: Use
linked style sheets whenever you can. Some of the examples in this topic may use
embedded style sheets, but that's mainly because it's easier to give you one listing
The preceding list isn't exhaustive; you'll encounter more choices to make when design-
ing and using CSS, but you should have learned enough by now to answer them.
Style Sheet Organization
The way you organize your style sheet can affect how easy it is for you to use and main-
tain your CSS, even if the effects are not evident in the presentation. This becomes even
more critical if you're in a situation where someone else may have to use your styles in
the future. You may work with an organization where multiple people will be working on
the same site, or perhaps when you move on to another job your successor will inherit
your style sheets.
To make a great style sheet, be organized and clear in what you're doing, and above all,
use comments. Web developers often overlook comments in CSS, but if you have to
come back later and try to figure out why you did something, they're invaluable.
Comments can also be used to group related styles together into sections.