修改select的样式(修改select右边的小三角-解决浏览器样式不一致问题)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <style>
        select {
            /*Chrome和Firefox里面的边框是不一样的,所以复写了一下*/
            border: none;
            outline: none;

            /*很关键:将默认的select选择框样式清除*/
            appearance:none;
            -moz-appearance:none;
            -webkit-appearance:none;

            /*在选择框的最右侧中间显示小箭头图片*/
            background: url("http://ourjs.github.io/static/2015/arrow.png") no-repeat scroll right center transparent;


            /*为下拉小箭头留出一点位置,避免被文字覆盖*/
            padding-right: 18px;
        }


        /*清除ie的默认选择框样式清除,隐藏下拉箭头*/
        select::-ms-expand { display: none; }
    </style>
</head>
<body>
<select>
    <option>CH</option>
    <option>EN</option>
</select>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/weixin_42651014/article/details/86636186