HTML and CSS Reference
In-Depth Information
particularly without shorthand CSS properties, and CSS designs may actually be much
larger than similar HTML-focused designs. When these styles are used inline or in a
<style> block, the speed gain of CSS over HTML is pretty much eliminated. In the case of
an external style sheet, assuming caching is properly used, download gains may come on
subsequent page views as they do not need to refetch the style information which cached in
the external style sheet. Of course assuming that caching is correctly implemented is not a
given and a blanket assertion that CSS results in more download-friendly pages is false and
does not acknowledge the complexity of page-delivery optimization. Of course, in fairness
it should be noted that even if CSS was always larger, which is not the case, the technology
provides a richer and more appropriate feature set than presentational markup.
Misconception: Redesigns Are Fundamentally Easier with CSS
A common thought promoted in the Web development community is that redesigning a
Web site is just a matter of changing styles. However, nothing could be farther from the
truth in the author's experience. Significant redesign often means changing navigation,
changing content, and even changing the focus of a site. A style sheet is not going to apply
necessarily to pages that are fundamentally different in structure and content. This
observation doesn't suggest style sheets aren't useful but it should serve to correctly lower
expectations in regard to the simplicity of changing a look during a site redesign. If,
however, the point is simply a new skin for an existing site, CSS clearly can deliver the
promise of a quick new look.
Misconception: CSS Should Support Also Interactivity
Already we see that features implemented in JavaScript like rollovers and menus are being
implemented in CSS using simple pseudo-property selectors like :hover . Some browsers
like Internet Explorer have also implemented proprietary features to associate look to
interactivity, called behaviors. The trend toward blurring the line between presentation and
interaction is clear in HTML5 as well. The challenge we have here is that there is no
difference between making a mess by intermixing content, structure, and look and making a
mess by intermixing style and interaction. A decoupled or, more appropriately, loosely
coupled relationship is the way to go for the same update and separation of concerns goal
discussed so many times before. Unfortunately, like many technologies, we often have to
relearn hard lessons in the light of new environments.
Summary
CSS provides better control over the look and feel of Web pages. Style sheets aren't just useful
for making attractive pages. By dividing structure and style, they can make documents simpler
to create and easier to manipulate. CSS provides many valuable layout properties that provide
a richer palette for design than presentation markup ever could. CSS should not be considered
a replacement for markup, however, as it relies greatly on correct (X)HTML markup as
well as proper naming of tags. While developers have found the promise of CSS alluring, the
execution of correct style sheets in browsers can be quite challenging. Cross-browser rendering
headaches reemerge with a vengeance under CSS, and we find that the incorrect solutions of
hacking around for filtering and selection shows the necessity of client-side scripting.
Search WWH ::




Custom Search