开发者

How do you replace the arrow button on <select> element with css?

Trying to style the select element on a form with an image for the dropdown arrow. Dont know开发者_如何学JAVA if this is possible yet.


Add this style to your

.styled-select {
   background: url(new_arrow.png) no-repeat right #fff;
}

Source: http://bavotasan.com/2011/style-select-box-using-only-css/


Style it with CSS and use pointer events :

<label>
<select>
   <option value="0">Zero</option>
   <option value="1">One</option>
</select>
</label>

and the relative CSS is

label:after {
    content:'\25BC';
    display:inline-block;
    color:#000;
    background-color:#fff;
    margin-left:-17px;   /* remove the damn :after space */
    pointer-events:none; /* let the click pass trough */
}

use a block with image background if you want to, I'm just using a down arrow here. Here is a ugly fiddle sample: https://jsfiddle.net/1rofzz89/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜