【发布时间】:2021-04-06 12:54:39
【问题描述】:
我有一个看起来像这样的标题:
我找到了一个我想要的例子。在小屏幕上,我需要搜索栏进入下方。:
问题是我不知道这是怎么做到的。当我达到一定的屏幕宽度时,我尝试将位置更改为相对位置,但这没有帮助。
<div className="header">
<div className="header__logo">
<img src={logo} alt=""></img>
</div>
<div className="header__search">
<SearchBar />
</div>
<div className="header__right">
<FiUser className="header__icon" />
<Cart />
</div>
</div>
/*
header
*/
.header {
width: 100%;
height: 60px;
border-bottom: 1px solid #e4e4e4;
display: flex;
justify-content: center;
}
.header__logo {
width: 120px;
height: 60px;
line-height: 65px;
}
.header__logo img {
width: 120px;
background-size: contain;
}
.header__search {
width: 50%;
height: 60px;
line-height: 60px;
margin: 0 20px 0 20px;
text-align: center;
}
.header__right {
width: 120px;
height: 60px;
line-height: 60px;
display: flex;
justify-content: space-between;
}
.header__icon {
height: 30px;
width: 30px;
margin-top: 15px;
cursor: pointer;
}
我不需要你为我编写代码,我自己就可以,我只是不知道该怎么做。
【问题讨论】: