我有一个标签和一个文本字段,我想要在同一行上显示。将标签和输入字段放在同一行上,并使用填充
我这里Label on the left side instead above an input field看这件事改变了我的代码使用form-inline
:
<div className="form-group form-inline">
<label style={{display: 'margin-right:10px'}}>Category</label>
<select className="form-control" value={this.state.selectCategoryValue} onChange={this.handleSelectCat} style={{display:'inline-block'}}>
<option value="defaultCategory" disabled selected></option>
{categoryDesc}
</select>
</div>
然而,现在有文本和输入字段之间没有填充的,虽然我尝试设置margin-right
:
我该如何在它们之间添加填充?
尝试设置标签为'style =“margin-right:10px; display:inline-block;”'或让select具有'style =“margin-left:10px; display:inline-block;” ' – Aeolingamenfel
看起来是一样的 – octavian
'className'属性应该是'class'。 –