Why Are Asterisks Used as Prefixes in Some CSS Properties?
Dec 18, 2024 am 05:23 AMUsing Asterisk Prefix in CSS: A Browser-Specific Hack
The Yahoo CSS reset includes the following lines:
body { font:13px/1.231 arial,helvetica,clean,sans-serif; *font-size:small; *font:x-small; }
The presence of asterisks before certain CSS properties raises the question of their purpose.
Answer:
The asterisks serve as a browser-specific CSS hack, primarily targeting Internet Explorer versions 7 and below. This hack takes the following form:
*property: value
While Internet Explorer 7 has addressed issues related to underscores and hyphens preceding property names, it continues to treat non-alphanumeric prefixes differently. Consequently, by adding an asterisk immediately before a property name, developers can ensure that the property is applied in IE, but not in other browsers.
It's important to note that this hack relies on invalid CSS. Moreover, future updates to the CSS specifications may render it ineffective. Therefore, it should be used with caution and only as a temporary solution.
The above is the detailed content of Why Are Asterisks Used as Prefixes in Some CSS Properties?. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Adding Box Shadows to WordPress Blocks and Elements

Create a JavaScript Contact Form With the Smart Forms Framework

Create an Inline Text Editor With the contentEditable Attribute

Making Your First Custom Svelte Transition

Comparing the 5 Best PHP Form Builders (And 3 Free Scripts)

File Upload With Multer in Node.js and Express

Best CSS Animations and Effects on CodeCanyon 2025 (Paid Free)
