搜索框页面实现

2019-02-20  本文已影响0人  有备而来的王

效果图


image.png

1.html

<div class="searchBar">
            <form action="" onsubmit="return false;">
                <div class="searchImg">
                    <img src="img/search.png"/>
                </div>
                <input type="search" class="search" placeholder="输入关键字搜索" value=""/>
                <span class="cancle">取消</span>
            </form>
        </div>

2.css

.searchBar{
    height: 30px;
    padding: 5px;
    position: relative;
}
.searchImg{
    display: inline-block;
    background-color: #f5f5f5;
    float: left;
    width: 30px;
    height: 30px;
    position: absolute;
}
.searchImg img {
    width: 16px;
    height: 16px;
    margin: 7px;
}
.search{
    padding: 5px 0px 5px 30px;
    background-color: #f5f5f5;
    line-height: 30px;
    height: 30px;
    border: none;
    box-sizing: border-box; 
    float: left;
    width: calc(100% - 40px);
    font-size: 13px;
    border-radius: 3px;
}
.search:focus { 
    outline: none;
    border: none;
}
.cancle{
    display: inline-block;
    height: 30px;
    line-height: 30px;
    width: 40px;
    float: left;
    text-align: center;
    font-size: 13px;
    color: cadetblue;
}
上一篇 下一篇

猜你喜欢

热点阅读