在IE8及更低版本中具有选择性的CSS3伪类



如果:使用选择性检查,我在设置无线电输入的样式时遇到问题。你能帮我如何让它与选择性一起工作吗?如果有另一种方法可以做到这一点,请在下面进行说明。这是指向我的网站的链接: test_radio_buttons 下面是我的 CSS 和 HTML 代码?谢谢大家的时间和努力。

.HTML:

<!DOCTYPE HTML>
<html>
<head>
    <meta http-equiv="content-type" content="text/html" />
    <meta name="author" content="lolkittens" />
    <link rel="stylesheet" type="text/css" href="style.css" />
    <script type="text/javascript" src="jquery-1.10.1.min.js"></script>
    <script type="text/javascript" src="checked-polyfill.js"></script>
     <script>
        $( document ).ready(function(){
            $('input:radio').checkedPolyfill();
       });
     </script>
    <link href="style.css" rel="stylesheet" />
    <title>Radio</title>
</head>
<body>
<form>
    <input type="radio" id="musi_se_jmenovat_stejne1" name="address" />
    <label for="musi_se_jmenovat_stejne1"></label>
    <input type="radio" id="musi_se_jmenovat_stejne2" name="address" />
    <label for="musi_se_jmenovat_stejne2"></label>
</form>
</body>
</html>

.CSS:

input[type="radio"]{
    display:none;
}
input[type="radio"] + label
{
    background: url('radio_un.gif');
    height: 16px;
    width: 16px;
    display:inline-block;
    padding: 0 0 0 0px;
}
input[type="radio"]:checked + label
{
    background: url('radio_in.gif');
    height: 16px;
    width: 16px;
    display:inline-block;
    padding: 0 0 0 0px;
}
input[type="radio"].checked + label{
    background: url('radio_in.gif');
    height: 16px;
    width: 16px;
    display:inline-block;
    padding: 0 0 0 0px;
}

像这样的多边形填充: https://github.com/rdebeasi/checked-polyfill 确实对我有用。当标签上触发 onchange 事件时,它会在 IE8 中添加一个选中的类。

我确实记得在selectivizr和使它工作时遇到了问题.
请参阅此处的小提琴:http://fiddle.jshell.net/5a7Gj/15/
在浏览器堆栈上的IE8中测试,它不适用于selectivr。它不添加任何已检查的类。

input[type="radio"]:checked + label
{
    background: url('radio_in.gif');
    height: 16px;
    width: 16px;
    display:inline-block;
    padding: 0 0 0 0px;
}
input[type="radio"].checked
{
    background: url('radio_in.gif');
    height: 16px;
    width: 16px;
    display:inline-block;
    padding: 0 0 0 0px;
}

最新更新