Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does a star-preceded property mean in CSS?

Tags:

css

I was looking at a css file today and found the following rule set:

div.with-some-class {     display:block;                        margin:0;     padding:2px 0 0 0;     *padding:1px 0 0 0;     font-size:11px;        font-weight:normal;     *line-height:13px;     color:#3D9AD0; } 

What does the star mean in *padding and *line-height?

Thanks.

like image 861
Majid Fouladpour Avatar asked Nov 03 '09 14:11

Majid Fouladpour


People also ask

What does a star represent in CSS?

An asterisk ( i.e. "*" ) is used to denote a CSS universal selector. An asterisk can also be followed by a selector. This is useful when you want to set a style for of all the elements of an HTML page or for all of the elements within an element of an HTML page.

What does CSS property mean?

The property is the color piece of this declaration. It dictates which aspect of the selector will be changed visually. The value is what the chosen CSS property will be changed to. In our example, we are using the hex value of #000, which is CSS shorthand for "black."

What is property value in CSS?

The used value of a CSS property is its value after all calculations have been performed on the computed value. After the user agent has finished its calculations, every CSS property has a used value. The used values of dimensions (e.g., width , line-height ) are in pixels.

What is all property in CSS?

The all property in CSS resets all of the selected element's properties, except the direction and unicode-bidi properties that control text direction. .module { all: unset; } The point of it is allowing for component-level resetting of styles.


2 Answers

This is the "star property hack" along the same lines as the "underscore hack." It includes junk before the property that IE ignores (the * works up to IE 7, the _ up to IE 6).

like image 109
opello Avatar answered Sep 21 '22 07:09

opello


In CSS? Nothing; it is an error.

Due to bugs in some versions of Internet Explorer, they won't correctly ignore the invalid property name, so this is one way of providing CSS that is specific to those browsers.

Using conditional comments is clearer and safer though.

like image 36
Quentin Avatar answered Sep 23 '22 07:09

Quentin