Possible Duplicate:
What does an asterisk do in a CSS property name?
I am trying to figure out what the asterisk (*) means next to the "vertical-align: middle" property in this CSS file:
button, input, select, textarea {
font-family: sans-serif;
font-size: 100%;
margin: 0;
vertical-align: baseline;
*vertical-align: middle;
}
Also, why would "vertical-align" be repeated twice, with the asterisk value different than the first?
I know what it means next to the class name, but I've never seen it next to a property.
The asterisk (*) is known as the CSS universal selectors. It can be used to select any and all types of elements in an HTML page. The asterisk can also be followed by a selector while using to select a child object. This selector is useful when we want to select all the elements on the page. For example: * { property : value; }
The “asterisk” (*) is the universal selector and applies styles to all elements. If you said * {color:red} then all elements that accept the property color will be red. If you said: div * {color:red} then only elements that are children of a div will be red.
For example they use an asterisk before the html tag like this: * html .left {margin-right: -3px;}. And they use forward slashes in the middle of a classes property like this: * html .outer {width: 480px; wid h: 478px;}. Also shown above are two of the same properties of "width".
The asterisk sybolises the universal selector, which can be handy when resetting margin/padding; in terms of it’s influence, it’s the highest selector, so applies it styles to all elements. I think in the instance you have it in, IE6 can give that rule priority over a duplicate rule without the global selector included
It's a CSS hack. Only IE7 and below will recognize it.
I wouldn't recommend using it. Instead, use IE conditional comments to render a different class name for the BODY tag depending on the version of IE being used.
When I have to deal with old versions of IE, I use a method similar to this:
http://nicolasgallagher.com/better-conditional-classnames-for-hack-free-css/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With