【发布时间】:2021-06-02 17:16:06
【问题描述】:
我必须在不使用&nbsp 的情况下在两个输入字段之间添加空格。我也尝试过添加{' '},但这没有任何区别
这是它们的呈现方式:
return (
<div className="side-by-side">
<Input
style={{ marginRight: 100 }}
classname="flex w-49"
label="first name"
type="text"
placeholder="Enter first name..."
inputId="basicInput"
value={obj.firstName}
></Input>
{' '}
<Input
classname="flex w-49"
label="last name"
type="text"
placeholder="Enter last name..."
inputId="basicInput"
value={obj.lastName}
></Input>
</div>
这是我用来将它们放在同一行中的 css
.side-by-side {
display: flex;
flex-direction: row;
align-items: center;
margin-left: 4px; //also tried to add a margin but that didn't work
}
【问题讨论】:
-
您需要为您的输入留出余量
-
即使我添加了边距,似乎也没有什么不同