Rule Definition
Underscore & star hacks rely on buggy parsers in old IE.
Remediation
Remove hacks; use proper cascading / specific selectors or feature detection.
Violation Code Sample
.box {
width: 300px;
*width: 320px; /* IE7 */
_width: 280px; /* IE6 */
}
Fixed Code Sample
.box {
width: 320px;
}
/* If absolutely needed, separate stylesheets or classes for legacy browsers */
.legacy-ie6 .box {
width: 280px;
}
Reference
W3C – CSS Syntax and Error Handling (why hacks are invalid):
https://www.w3.org/TR/css-syntax-3/
MDN – Writing forward-compatible CSS:
https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/Handling_different_text_directions
Related Technologies
Technical Criterion
CWE-710 - Improper Adherence to Coding Standards [Pillar]
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.