box {
width: 300px;
}
The box model hack itself was later simplified further, to the simplified box model hack (or
SBMH), which involved using a single backslash in the second pair to get Internet Explorer
5.x to terminate the rule:
.box {
padding: 20px;
width: 340px;
w\idth: 300px;
}
DEALING WITH BROWSER QUIRKS
355
9
In a sense the opposite of the box model hack, the star HTML hack is also often seen, in
order to make only Internet Explorer see a rule:
* html .box {
background: #000000;
}
There are myriad other CSS hacks out there, but they won??™t be explored here. Not only do
hacks mess up your otherwise clean and compliant style sheet, but they??™re also not futureproof,
as evidenced when the star HTML hack stopped working upon the release of
Internet Explorer 7. Also, hacks often need overrides, as evidenced by the ???be nice to
Opera??? hack. A far better and more future-proof method is to ditch CSS hacks entirely,
instead making a totally clean style sheet for a website, and using conditional comments to
fix bugs in Internet Explorer.
Conditional comments
Conditional comments are proprietary code that??™s only understood by Microsoft browsers
from version 5 onward, but as they??™re wrapped up in standard HTML comments, they
don??™t affect other browsers, and they are also considered perfectly valid by the W3C??™s validation
services. What conditional comments enable you to do is target either a specific
release of Internet Explorer or a group of releases by way of expressions.
Pages:
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458