css - react-bootstrap 表单边距导致溢出
问题描述
我今天刚刚进入 react-bootstrap。我希望表单位于左右两侧有边距的 div 中。我的 jsx 看起来像这样:
const Settings = () =>{
return(
<div className="content">
<div className="box">
{/* Actual form with course info */}
<Form className="course-info">
<Form.Group as={Row} controlId="formHorizontalEmail">
<Form.Label variant="settingsLabel" column sm={3}>
Course Title
</Form.Label>
<Col sm={5}>
<Form.Control/>
</Col>
</Form.Group>
</Form>
</div>
</div>
);
}
CSS:
/* A big wrapper for everything on this page */
.content{
display: flex;
align-items: center;
justify-content: center;
}
/* The box containing the class settings */
.box {
width: 600px;
height: 600px;
border: 30px solid #A6D1DF;
margin-top:50px;
}
.center-items{
margin-top: 1em;
text-align: center;
}
/* Gives the form left/right margin and sets text color */
.course-info {
padding-left: 20px;
color: #9E7772;
}
Form.Label-settingsLabel {
font-size: 1em;
color: red;
}
并且表单内容溢出框的右侧,删除边距可以解决问题。但是,我仍然希望该边距用于样式目的。有什么建议么?谢谢
解决方案
推荐阅读
- python - UserMixin 继承扰乱了python list.count() 方法
- mysql - MySQL - 如何计算“还查看过的产品”,按频率排序
- ios - Swift/IOS 如何使用观察者进行更新
- python - 在 MacOS 上安装多个版本的 Python 3
- angular - 订阅角度时无法在 ngoninit 中获得价值
- ios - 为什么带有子视图控制器的 UIViewController 有时会返回 children[0].isEmpty = true?
- android - 领域一对多关系不持久
- php - PHP错误显示MySQL服务器已消失错误
- node.js - 在数组中查找元素告诉我参数必须是对象
- scala - 如何读取带有可变分隔符的 ASCII 文件?