Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does an asterisk mean next to a CSS property? [duplicate]

Tags:

html

css

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.

like image 236
MultiDev Avatar asked Jul 01 '12 23:07

MultiDev


People also ask

What is asterisk (*) selector in CSS?

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; }

What is the difference between * and * the “asterisk”?

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.

How do you put an asterisk before an HTML tag?

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".

What is the point of the asterisk around the global selector?

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


1 Answers

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/

like image 166
DA. Avatar answered Sep 19 '22 12:09

DA.