【发布时间】:2020-05-24 08:13:11
【问题描述】:
我试图在 html 和 css 中创建一个简单的搜索栏。但是, justify-content 和 align-items 不起作用。有人可以帮我找出原因吗?
https://codepen.io/Lavender786/pen/yLYwRBP
input[type=text] {
width: 400px;
box-sizing: border-box;
border: 2px solid #ccc;
border-radius: 4px;
font-size: 16px;
background-color: white;
background-position: 10px 10px;
background-repeat: no-repeat;
padding: 12px 20px 12px 40px;
}
.container {
align-items: center;
justify-content: center;
}
<div id = "container">
<form>
<input type="text" name="search" placeholder="Search...">
</form>
</div>
【问题讨论】: