在IE6、7中用height来设定SELECT标签高度是无效的,宽度的话各浏览器设置都是一致的,解决方法就是在select外嵌套两层标签,一层用来遮挡select的默认边框(在IE6、7中设置border:0px也是无效的),另一层用来模拟”高度改变后的“select边框.
代码如下
html代码
<div class="standard_select">
    <!--边框-->
    <div class="select_shelter">
        <!--遮挡默认边框-->
        <select>
            <option selected="selected">水果</option>
            <option>苹果</option>
            <option>橘子</option>
            <option>葡萄</option>
            <option>桃子</option>
        </select>
    </div>
</div>

css代码

 .standard_select{ /*边框*/
            display:inline-block;
            *display:inline;
            zoom:1;
            border:solid 1px black;
            padding:5px; /*调整此处改变select高度*/
            *padding:7px;
        }
        .select_shelter{ /*遮挡默认边框*/
            display:inline-block;
            *display:inline;
            zoom:1;
            width:100px;
            *width:98px;
            height:20px;
            overflow:hidden;
        }
        select{
            *margin:-1px;
            padding:3px;
            border:0px;/*遮挡现代浏览器的select边框*/
            width:100px;
        }

 

相关文章:

  • 2021-10-14
  • 2022-12-23
  • 2022-01-29
  • 2022-12-23
  • 2021-07-15
  • 2022-12-23
  • 2021-10-17
猜你喜欢
  • 2022-12-23
  • 2021-08-18
  • 2022-12-23
  • 2021-07-19
  • 2022-12-23
  • 2021-06-21
  • 2021-12-07
相关资源
相似解决方案