【发布时间】:2021-01-22 11:36:06
【问题描述】:
我正在 react-bootstrap 中练习网格布局。但是当我试图去除容器流体的填充物时卡住了。我们可以通过覆盖 container-fluid 类并将填充 0 设为重要来在常规引导程序中做到这一点。
.container-fluid {
padding: 0 !important;
}
我尝试过这种方式,效果很好,但我不想使用!important,因为以后我的应用程序中可能会有很多容器流体。
<Container fluid>
<Row noGutters>
<Col lg={6} md={6} xs={12}>
<div style={{ background: "red" }}>hello i am subrato</div>
</Col>
<Col lg={6} md={6} xs={12}>
<div style={{ background: "blue" }}>I new to react-bootstrap</div>
</Col>
</Row>
<Row noGutters>
<Col xs={12} md={8}>
<div style={{ background: "red" }}>hello i am subrato</div>
</Col>
<Col xs={12} md={4}>
<div style={{ background: "blue" }}>I new to react-bootstrap</div>
</Col>
</Row>
</Container>
在这里查看我的输出
如何在 react-bootstrap 中专门选择该容器?
【问题讨论】:
-
不,它不会工作@GonzaloFaus。看我的回答。
-
@Gonzalo Hola!!我已经使用
!important并且效果很好,但我不想使用!important。有没有其他方法可以去除填充物? -
还删除了 !important 属性。
-
不,如果我们删除导入 URL,它将不起作用
标签: css reactjs react-bootstrap