【发布时间】:2021-08-14 19:09:04
【问题描述】:
我创建了如下所示的自定义输入:
<div className="custom-input-container">
<label className="custom-input-label" htmlFor="input">Name</label>
<input type="email" className="custom-input" id="input" placeholder="Insert your name</input>
</div>
.custom-input-container {
min-width: 300px;
.custom-input {
width: 100%;
height: 56px;
}
}
我正在尝试创建一个包含 2 行的布局。第一行有两个输入应该占用整个可用空间,第二行输入应该占用可用空间的一半。
我尝试实现这一点,但使用 flex 和 flex-wrap 没有成功(仍然只占用 300px,flex-basis 也没有帮助)。
<div className="billing-details-container flex flex-wrap">
<CustomInput />
<CustomInput />
<CustomInput />
</div>
.billing-details-container {
& > *:first-child {
margin-bottom: 24px;
margin-right: 16px;
}
& > *:last-child {
margin-bottom: 50px;
}
}
知道如何实现吗?
【问题讨论】:
-
@isherwood 我刚刚创建了一些助手,flex 基本上是
display: flex,flex-wrap 是flex-wrap:wrap -
这似乎与您的问题高度相关。请把它放在那里。您还应该使用您的代码创建有效的 sn-ps。避免出于演示目的使用自定义组件。