?。。。。
css吧
全部回复
仅看楼主
level 2
鲨蔽文库 楼主
问问这input为什么离盒子顶部有距离,怎么解决
2022年10月10日 15点10分 1
level 7
首先,从HTML结构上就混乱。
下划线用来表示缩进,不是代码的一部分。
<div id="Logo加搜索区域">
__<img src="logo.png" alt="Logo图片">
__<div id="搜索区域">
____<div id="搜索框">
______<input placeholder="搜索框">
______<button type="submit">搜索按钮</button>
____</div>
____<ul id="推荐搜索区域">
______<li>…</li>
____</ul>
__</div>
</div>
然后,如果用了float的话,可能就会出这样的问题。试试flex:
#搜索框 {
display:flex
}
#搜索框 button {
width:fit-content;
flex: 0 1;
/* padding等样式... */
}
2022年10月11日 05点10分 2
1