Meaning of '*' before any CSS attribute [duplicate] - css

This question already has answers here:
What does a star-preceded property mean in CSS?
(4 answers)
Closed 9 years ago.
what is meaning of '*' before any CSS attribute like.
.hello
{
margin-top:5px;
*margin-top:10px;
}
Thanks
Vishal

I'll answer this because it has a quick answer. Basically it's a hack to define IE only styles. IE will ignore the syntax error and apply the CSS rule anyway. However I don't recommend it. Instead use conditional comments because its safer

Related

CSS selector by tabindex [duplicate]

This question already has an answer here:
CSS data attribute conditional value selector?
(1 answer)
Closed 6 years ago.
I want to write this in CSS li[tabindex > '5'] {} to select all tabindex which have a number greater than 5. Is it possible ?
This can´t be made with CSS.
I am no expert with javascript so I can´t provide you the code, but I´m sure you can achieve it with js.
maybe this gives you a good start:
jQuery: Selecting all elements where attribute is greater than a value

Is this a possible CSS property? [duplicate]

This question already has answers here:
Purpose of asterisk before a CSS property
(6 answers)
What does an asterisk do in a CSS property name? [duplicate]
(4 answers)
Closed 9 years ago.
I found this properties in a CSS file from a know blog. I severely questioned its use and if it is allowed to use them, so here is the code.
*margin
*padding
Real example:
.offset1 {
margin-left: 11.325966850829%;
*margin-left: 11.219583872105%
}
It's a hack to deal with Internet Explorer compatibility
See here
It is a hack for Internet Explorer.
http://en.wikipedia.org/wiki/CSS_filter
http://www.paulirish.com/2009/browser-specific-css-hacks/
It's a hack, used to apply different styles to older IE browsers.
http://www.javascriptkit.com/dhtmltutors/csshacks3.shtml#unrecommended-asterisk_prefix
Tha means that selector is targeting ie7 and below only

What does hash in IE style mean? [duplicate]

This question already has answers here:
Hash sign in front of property name - CSS browser hack?
(2 answers)
Closed 9 years ago.
I have a sample CSS that I downloaded that has the entry
#text-align: right;
in it. The comment next to the entry says that this expression justifies it for IE, whereas
text-align: right;
works for Safari and Chrome. My question: what is the significance of the hash in this context?
Thanks!
This is something called a "CSS hack" which alters the behavior of IE because it is so terrible and doesn't support the latest CSS definitions. Other browsers will ignore the statement entirely (as if it were a comment) but IE will treat it as text-align:right;

Can I use attr() inside background url() in CSS? [duplicate]

This question already has an answer here:
Using HTML attributes as CSS property values [duplicate]
(1 answer)
Closed 9 years ago.
I would like to do this in HTML:
text
and in CSS:
a {
background-image: url(attr(href));
}
It doesn't seem to work for me. Is it even possible?
Not possible in static CSS file. However you can have dynamically generated CSS by any server side language such as PHP.
Or use Sass or LESS if you need variables in CSS.

What is the use of star sign in CSS? [duplicate]

This question already has answers here:
Closed 11 years ago.
Possible Duplicate:
What does a star-preceded property mean in CSS?
I downloaded CSS file for one of jQuery scripts and it look like this
.usual div {
*margin-top:-15px;
clear:left;
background:snow;
font:10pt Georgia;
}
what is the use of star sign?
This is a hack for IE7 and under. Only those browsers will respond to the CSS rule, as it's considered invalid to all other browsers.
It's a hack to, in this case, change positioning in certain versions of IE.
The CSS standard says to ignore properties whose names are preceded with some character, but some versions of Internet Explorer ignore this. Some you might see are:
*someproperty: somevalue - IE7 and earlier affected
_someproperty: somevalue - IE6 and earlier affected
#someproperty: somevalue - I forget. Probably the same effect as *.
You should probably use conditional comments instead, however.

Resources