Parsing Exception: Asterisk in CSS Property Name
This question delves into the peculiar behavior of an asterisk (*) within a CSS property name, a feature notably absent in CSS selectors.
An example provided by the user showcases '*display' in a CSS rule:
.yui-button .first-child { display:block; *display:inline-block; }
Parsing Error
Contrary to expectations, '*display' is not a valid property name in CSS. Its presence renders the property invalid and aborts its parsing.
Browser Bugs and Quirks
However, due to historical browser quirks, some browsers (most prominently IE7) may overlook this invalidity and implement the rule as if '*display' were legitimate.
Avoidance and Best Practices
For cross-browser compatibility and to maintain code quality, it is highly recommended to avoid using an asterisk in property names. Instead, conditional comments should be employed to target specific browsers.
The above is the detailed content of Why Does an Asterisk in a CSS Property Name (*display) Cause a Parsing Exception?. For more information, please follow other related articles on the PHP Chinese website!