CSS input 去除默认和聚焦边框、添加自定义前缀效果

一、原始样式

html

<input type="text" >

效果

二、去除边框

input{
    /* 去除默认边框 */
    border:none; 
    /* 去除选中或聚焦边框 */
    outline: none;
}

css

图中白色就是input聚焦时的效果,为了效果清晰,添加了灰色背景。

3、添加前缀

html

<div class="input-div">
    <img :src="require('@images/filter.png')" alt="" srcset="">
    <input type="text" name="" id="" placeholder="搜索" v-model="filter">
</div>

css

.input-main {
    padding: 20px;   
    background: #ccc; 
}
.input-div {
    width: 290px;
        height: 32px;
        background: rgba(34, 68, 114, 0.9);
        margin-top: 16px;
        margin-left: 12px;        
}
img{
    vertical-align:middle;
    margin: 2px 8px;
}
input{
    width: 258px;
    height: 32px;
    /* 去除默认边框 */
    border:none; 
    /* 去除选中或聚焦边框 */
    outline: none;
    background: rgba(0, 0, 0, 0);
}

效果

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值