美文网首页
搜索框页面实现

搜索框页面实现

作者: 有备而来的王 | 来源:发表于2019-02-20 16:42 被阅读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;
}

相关文章

网友评论

      本文标题:搜索框页面实现

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