Reputation:
Is it possible to use conditional style inside tag as shown below?
<body>
<div id="InScreenAlertContainer"
<!--[if IE]>
<style>width=100%</style>
<![endif]-->
>
...
</div>
...
</body>
Upvotes: 0
Views: 5931
Reputation: 1788
You can try this :
#div{
padding: 10px; /* standard */
padding: 17px\9; /* IE 8 and below */
*padding: 15px\9; /* IE 7 and below */
_padding: 16px\9; /* IE 6 */
}
OR
<!--[if IE]><p>You are using Internet Explorer.</p><![endif]-->
<![if !IE]><p>You are not using Internet Explorer.</p><![endif]>
<!--[if IE 7]><p>Welcome to Internet Explorer 7!</p><![endif]-->
<!--[if !(IE 7)]><p>You are not using version 7.</p><![endif]-->
<!--[if gte IE 7]><p>You are using IE 7 or greater.</p><![endif]-->
<!--[if (IE 5)]><p>You are using IE 5 (any version).</p><![endif]-->
<!--[if (gte IE 5.5)&(lt IE 7)]><p>You are using IE 5.5 or IE 6.</p><![endif]-->
<!--[if lt IE 5.5]><p>Please upgrade your version of Internet Explorer.</p><![endif]-->
<!--[if true]>You are using an <em>uplevel</em> browser.<![endif]-->
<![if false]>You are using a <em>downlevel</em> browser.<![endif]>
<!--[if true]><![if IE 7]><p>This nested comment is displayed in IE 7.</p><![endif]><![endif]-->
Reference :
Upvotes: 1
Reputation: 8068
Maybe you could try something like this, but i haven't tested it.
<!--[if IE 6]>
<style>
.mywidht{
width:100px;
}
</style>
<![endif]-->
Upvotes: 0
Reputation: 154111
Use a conditional style sheet depending on which browser is used
<!--[if IE 6]>
<link rel="stylesheet" type="text/css" href="iespecific.css" />
<![endif]-->
Source: http://www.thesitewizard.com/css/excludecss.shtml
The JQuery .css
method lets you specify a style that takes effect after an event
//On Button Click - applies a style on click.
$('#change').click(function()
{
$('body').css('background-color',$('#color').val());
});
Source: Change CSS rule at runtime
Upvotes: 1