1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > ie select option css ie浏览器不支持select option italic

ie select option css ie浏览器不支持select option italic

时间:2019-01-07 12:08:51

相关推荐

ie select option css ie浏览器不支持select option italic

由于项目需要,要实现select option斜体样式:

1

发现在ie8下根本不支持,chrom下可以。

后来查阅资料发现:

好吧,如果ie下非要select option 非要实现样式斜体,可以使用div+css方式模拟select:

htmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""/TR/xhtml1/DTD/xhtml1-transitional.dtd">

body,ul,li{margin:0;padding:0;font-size:13px;}

ul,li{list-style:none;}

.divselect{width:52px;margin:80pxauto;position:relative;z-index:10000;}

.divselectcite{height:24px;line-height:24px;display:block;cursor:pointer;font-style:normal;

padding-left:4px;padding-right:30px;border:1pxsolid#333333;

background:url(xjt.png)no-repeatrightcenter;}

.divselectul{width:50px;border:1pxsolid#333333;background-color:#ffffff;position:absolute;z-index:20000;margin-top:-1px;display:none;}

.divselectulli{height:24px;line-height:24px;}

.divselectullia{display:block;height:24px;color:#333333;text-decoration:none;padding-left:10px;padding-right:10px;}

.divselectullia:hover{background-color:#CCC;}

jQuery.divselect=function(divselectid,inputselectid){

varinputselect=$(inputselectid);

$(divselectid+"cite").click(function(){

varul=$(divselectid+"ul");

if(ul.css("display")=="none"){

ul.slideDown("fast");

}else{

ul.slideUp("fast");

}

});

$(divselectid+"ullia").click(function(){

vartxt=$(this).text();

$(divselectid+"cite").html(txt);

$(divselectid+"cite").attr("style",$(this).attr("style"));

$(divselectid+"cite").css("background-color","#CCC");

$(divselectid+"cite").focus();

varvalue=$(this).attr("selectid");

inputselect.val(value);

$(divselectid+"ul").hide();

window.event.cancelBubble=true;

});

$(document).click(function(){

$(divselectid+"ul").hide();

$(divselectid+"cite").css("background-color","");

});

};

$(function(){

$.divselect("#selectid","#inputid");

});

YNNA

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。