美文网首页
select文字右对齐样式

select文字右对齐样式

作者: 城南花已_开 | 来源:发表于2019-06-10 17:07 被阅读0次

最近在用原生的select时,需要文字右对齐还要有图标
PC上效果图如下


select.png

注意到select无边框,文字右对齐,图标自定义

<select class="select-order" v-model="selectclock">
                    <option v-for="item in arrayclock" :value="item.key">{{item.name}}</option>
                </select>

CSS样式

.select-order{
    float: right;
    padding:0 25px 0 0;
    width: 200px;
    height: 30px;
    background-color: transparent;
    border: 0;
    outline: none;
    text-align: right;
    direction: rtl;
    appearance:none;
    background: url(../../../static/icon_select.png) no-repeat right;
    background-size: 25px 25px;
}
select option{
    direction: ltr;
}

文字右对齐由direction属性控制,
自定义图标先设置
appearance:none;
再设置背景图片属性和尺寸,
对了,别忘了outline:none;

相关文章

网友评论

      本文标题:select文字右对齐样式

      本文链接:https://www.haomeiwen.com/subject/mpftfctx.html