我想将FormGroup和h1标签水平并排放置。我试过使用display:inline-block和其他各种东西,但是没有运气。这是我的.css代码:
.testingForm {
max-width: 320px;
}
.testingMore {
text-align: left;
float: right;
}
这是.js代码:
<div className="testingForm">
<FormGroup
controlId="stuff"
bsSize="large"
>
<ControlLabel>Stuff</ControlLabel>
<FormControl
/>
</FormGroup>
</div>
<div className="testingMore">
<h1>Additional Stuff</h1>
</div>
答案 0 :(得分:1)
您可以创建一个同时包裹表单和标头的元素,并使用flex
将其放入display:flex;
容器中
.form-wrapper {
display: flex;
}
.testingForm {
max-width: 320px;
}
h1 {
margin-top: 0;
}
<div class="form-wrapper">
<div className="testingForm">
<form>
Test: <input type="text"/>
</form>
</div>
<div>
<h1>Additional Stuff</h1>
</div>
</div>