简体   繁体   中英

style sheet for check box only for ie8

I want different css for ie 8, i am doing like this but not working

/* for all browsers other than IE. */
input[type=checkbox]
{
  font-size: 12px;
  line-height: 1.2em;
  -webkit-appearance: none;
  background: url(../../images/uncheck.png) no-repeat right;
}


<!--[if IE 8]>
input[type=checkbox]
{
  font-size: 12px;
  line-height: 1.2em;
  -webkit-appearance: none;
}
<![endif]-->

Try this:

You need to mention css properties inside <style>

Add the following in head tag of HTML file but not in css file or in other <style tag.

<!--[if IE 8]>
    <style>
        input[type=checkbox] {
            font-size: 12px;
            line-height: 1.2em;
            /* -webkit-appearance: none; */
        }
    </style>
<![endif]-->

For more information, go through this link

 document.head.innerHTML += "the above text here"; //not sure whether this will fix that or not.

Solution 1

In your HTML, do something like this:

<!--[if IE 8]>
    <link rel="stylesheet" type="text/css" href="ie8.css"></link>
<![endif]-->

<link rel="stylesheet" type="text/css" href="stylesheet.css"></link>

Then put your IE8 css in ie8.css . You can't have conditional comments within the actual .css file

Solution 2

or change your DOCTYPE to :

<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]>    <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]>    <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->

So you can do .lt-ie9 .your-class and it will be applied to IE8 and under.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM