CSS Travesties

Those of us who were around and hard at work in the mid-1990s knew about CSS and prayed fervently for it to be implemented sooner and more effectively than it was. To make a long story extremely short, programming for the Web in the late ’90s sucked because it wasn’t.

Ten years on from the ultimate peak of “irrational exuberance,” we now have better CSS. Still, it’s not always so good at coping with the requirements of the contemporary Web. Its truly rough patches are described in the following sections.

@-Rules

As design elements go, @-rules are elegant. They provide an additional mechanism for narrowing scope via the cascade, which is awfully elegant on its own.

Unfortunately, they’re poorly supported. Consider:

  • @import rules might or might not be applied by a given browser, depending on how they’re written and where they’re located in the source order of a document or stylesheet.

  • @import and @media rules can take on additional, vendor-defined, arbitrary attributes that usually want for clear documentation.

  • Support for alternative media properties leaves a great deal to be desired, as discussed in Chapter 3.

Verdict

When @-rules work, they’re great, but when they don’t, they…don’t. Some of the features discussed here might pop serendipitously into your psyche and save you several hours of labor during a death march, but it’s very unlikely that @-rules will ever be among them.

Computed Values and Rounding Differences

Every visual display medium has a fundamental unit of length, ...

Get HTML & CSS: The Good Parts 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.