大致分布
<body>
<div class="searchFixed">
<a href="#" class="classify">
<!-- <img src="images/searchFixed1.png" alt=""> -->
</a>
<div class="search"></div>
<a href="#" class="login">
</a>
</div>
</body>
a {
text-decoration: none;
}
.searchFixed {
display: flex;
position: fixed;
top: 0;
left: 50%;
transform: translateX(-50%);
width: 10rem;
height: 1.1733rem;
background-color: #ffdb47;
}
.searchFixed .classify {
width: .48rem;
height: .8rem;
background: url(../images/searchFixed1.png) no-repeat;
background-size: .48rem .8rem;
/*背景图也需要根据屏幕大小改变而改变,
background-size: 就设置为和width、height一样的大小就OK;
*/
margin: .1467rem .3333rem .0933rem .32rem;
}
.searchFixed .search {
flex: 1;
}
.searchFixed .login {
width: .48rem;
height: .8rem;
margin: .1333rem;
background: url(../images/searchFixed2.png) no-repeat;
background-size: 100% 100%;
/*背景图也需要根据屏幕大小改变而改变,
background-size: 就设置为和width、height一样的大小就OK;
也可以直接写100% 100%
*/
}
中间搜索输入
<!-- 顶部固定搜索 -->
<div class="searchFixed">
<a href="#" class="classify">
<!-- <img src="images/searchFixed1.png" alt=""> -->
</a>
<div class="search">
<form action="#">
<input type="search" placeholder="三星S22系列100元预定">
</form>
</div>
<a href="#" class="login">
</a>
</div>
.searchFixed .search {
flex: 1;
}
.searchFixed .search input {
height: .8533rem;
border-radius: .8533rem;
width: 100%;
border: 0;
margin-top: .16rem;
padding: .04rem .2667rem 0 .8667rem;
font-size: .3733rem;
}
input {
/* 去除点击输入框时的轮廓效果 */
outline: none;
}