Reputation: 263
How to hack css Inline style only on IE ?
to hack css Inline style only on IE in all version, How can i do ?
Like that
<div style = "
color: #eee;
border: 1px solid #000;
for ie only // line-height : 32px;
"/>
Upvotes: 3
Views: 16906
Reputation: 371
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
#myElement {
/* Enter your style code */
}
}
Upvotes: 0
Reputation: 157324
You need to add *
before the property name, and that will target only IE7, so you need to write this line-height : 32px;
as *line-height : 32px;
As I realized you wanted hacks for each IE, so here you go
_
*
\0
\9
Declare styles for IE10 specifically using CSS Only
@media all and (-ms-high-contrast: none) {
/* This won't go inline but can be used at document level*/
/* Declaration Blocks Goes Here*/
}
You can read here for more information on how to declare IE only styles using @media
queries
Still I would suggest you to use conditional comments which will make your life much easier instead of declaring inline styles.
Upvotes: 5
Reputation: 1547
<!--[if IE]>
div.classname{
line-height: 32px; //ie only
}
<![endif]-->
Source: http://css-tricks.com/how-to-create-an-ie-only-stylesheet/
Edit:
Upvotes: 0