【发布时间】:2020-10-25 13:01:51
【问题描述】:
我为容器内的 Row 和 Col 组件提供了一个 className,那么为什么 padding 和 margin 属性在我的自定义类中不起作用?
我的反应代码-
<Container fluid id="about-title-container">
<Row className="about-title-row-1">
<Col className="about-title-row-1-col-1">
<h1 className="about-title-h1">About Us</h1>
</Col>
</Row>
</Container>
我的 CSS 代码-
.about-title-row-1{
padding: 4%;
text-align: center;
}
.about-title-row-1-col-1{
padding: 2%;
text-align: center;
}
【问题讨论】:
-
如果我使用 id 作为道具而不是 className 效果很好
标签: css reactjs padding margin react-bootstrap