在IE7中显示不完美

在IE7中显示不完美

我在纯CSS中创建自定义复选框和单选按钮,但它们在IE7中显示不完美。

任何身体的帮助

代码在那里,请检查一下

的HTML

<ul>
<li>
<fieldset>

<legend id="title1" class="desc">
Select a Choice
</legend>

<div>
<span>
<input id="Field1_0" name="Field1" type="radio" class="field radio"  checked="checked">
<label class="choice" for="Field1_0">
First Choice</label>
</span>
<span>
<input id="Field1_1" name="Field1" type="radio" class="field radio">
<label class="choice" for="Field1_1">
Second Choice</label>
</span>
<span>
<input id="Field1_2" name="Field1" type="radio" class="field radio">
<label class="choice" for="Field1_2">
Third Choice</label>
</span>
</div>
</fieldset>
</li>


<li>
<fieldset>

<legend id="title2" class="desc">
Check All That Apply
</legend>

<div>
<span>
<input id="Field2" name="Field2" type="checkbox" class="field checkbox" checked="checked">
<label class="choice" for="Field2">First Choice</label>
</span>
<span>
<input id="Field3" name="Field3" type="checkbox" class="field checkbox">
<label class="choice" for="Field3">Second Choice</label>
</span>
<span>
<input id="Field4" name="Field4" type="checkbox" class="field checkbox">
<label class="choice" for="Field4">Third Choice</label>
</span>
</div>
</fieldset>
</li>
</ul>​


的CSS

li:not(#foo) > fieldset > div > span > input[type='radio'],
li:not(#foo) > fieldset > div > span > input[type='checkbox']
{
    opacity: 0;
    float: left;
    width: 18px;
}

li:not(#foo) > fieldset > div > span > input[type='radio'] + label,
li:not(#foo) > fieldset > div > span > input[type='checkbox'] + label {
    margin: 0;
    clear: none;
    padding: 5px 0 4px 24px;
    /* Make look clickable because they are */
    cursor: pointer;
    background: url(https://css-tricks.com/wufoo/themes/customradiosandcheckboxes/off.png) left center no-repeat;
}

li:not(#foo) > fieldset > div > span > input[type='radio']:checked + label {
    background-image: url(https://css-tricks.com/wufoo/themes/customradiosandcheckboxes/radio.png);
}
li:not(#foo) > fieldset > div > span > input[type='checkbox']:checked + label {
    background-image: url(https://css-tricks.com/wufoo/themes/customradiosandcheckboxes/check.png);
}​


Live demo here http://jsfiddle.net/rohitazad/Vsvg2/79/

最佳答案

:checked是IEs8及以下浏览器不支持的css3的属性。但是您可以使用http://selectivizr.com/ JS实现此目标,该JS支持IE的所有css3伪选择器

关于html - 复选框和单选按钮在IE7中显示不完美?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9987017/

10-11 11:07