HeadlinesBriefing favicon HeadlinesBriefing.com

CSS Browser Hacks And Quirks From Web History

Hacker News •
×

CSS has evolved far beyond its original purpose, often taking on roles it was never designed for. In the early days of the web, browser inconsistencies forced developers to rely on creative workarounds. One infamous method was the "star hack," where properties prefixed with an asterisk were used to target Internet Explorer 7 and earlier, exploiting how those browsers parsed invalid CSS.

Similarly, the underscore and hyphen hacks targeted IE6, relying on the browser's lenient property parsing. Beyond parsing quirks, developers used the `!important` flag creatively; Internet Explorer 7 treated arbitrary text like `!ie` as important, unlike other browsers. Older versions of IE also had a bug where later declarations overwrote `!important` values.

Browser detection was often achieved through specific CSS selectors, such as `* html {}` for IE6 or `*:first-child+html {}` for IE7. The `has Layout` concept in older Internet Explorer dictated how elements rendered and handled layout, often causing collapse issues with floated children. The `zoom` property was used to trigger has Layout, though the system was widely considered obtuse.

While these hacks solved immediate compatibility problems, they highlight a turbulent era of web development where exploiting browser bugs was standard practice to achieve consistent designs across the fragmented landscape of early browsers.