伪标签+html,html – Internet Explorer中选择标记选项中的CSS伪元素

First Lets get one thing straight we can’t create what you desire in IE because it doesn’t allow anything other than , tags inside

a Box.

在我看来,这是我可以使用CSS only方法的一种解决方法.如果您更喜欢脚本,那么有很多替代品,即使select2是这种类型的自定义最常用的插件之一.

I Have used [type=”checkBox”] for attain this result

jQuery仅用于显示值.

var multyVal = [];

$('.multiple input[type="checkBox"]').each(function() {

if ($(this).is(':checked')) {

var Tval = $(this).val();

multyVal.push(Tval);

}

});

console.log($('select').val(),multyVal);

select>option::before {

display: inline-block;

width: 10em;

}

select>option:checked::before {

content: "SELECTED: ";

}

select>option:not(:checked)::before {

content: "excluded: ";

}

.multiple {

height: 60px;

display: inline-block;

overflow-y: scroll;

background: #d4d4d4;

width: 10em;

border: 1px solid #999;

margin-left: 10px;

}

.multiple [type="checkBox"] {

display: none;

}

.multiple label {

width: 100%;

float: left;

font-size: 13px;

text-align: right;

background: #fff;

}

.multiple label::before {

display: inline-block;

float: left;

font-family: arial,san-sarif;

font-size: 11px;

}

.multiple [type="checkBox"]:checked+label::before {

content: "SELECTED: ";

}

.multiple [type="checkBox"]:checked+label {

background: #666;

color: #fff;

}

.multiple [type="checkBox"]:not(:checked)+label::before {

content: "excluded: ";

}

1

2

3

4

5

1

2

3

4

5

Fiddle如果你想要一个.

希望这对你们来说很方便…

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值