【问题标题】:Set width to <option> on IE8在 IE8 上将宽度设置为 <option>
【发布时间】:2012-02-28 22:32:07
【问题描述】:

是否可以将宽度设置为选项?我尝试了很多方法来做到这一点,但直到现在,什么都没有:( 只有在 IE 上我有这个问题。已经试过了:

jQuery:

$( "select" ).toggle(
function() {
$( "option" ).animate({
width: 500
}, 1000 );
},
function() {
$( "option" ).animate({
width: 240
}, 1000 );
}
);

--其他 jQuery--

$("select")
.mouseover(function(){
$(this)
.data("origWidth", $(this).css("width"))
.css("width", "auto");
})
.mouseout(function(){
$(this).css("width", $(this).data("origWidth"));
});

-- css--

option{
width:auto;
}

--在 IE 以外的其他浏览器上都可以完美运行--

如果有人能帮我解决这个问题,我将不胜感激。

检查小提琴示例:http://jsfiddle.net/DCjYA/173/

【问题讨论】:

    标签: css internet-explorer-8


    【解决方案1】:

    试试option { display: block; }。如果需要对齐option { float: left; }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-10-19
      • 1970-01-01
      • 1970-01-01
      • 2011-08-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多