【问题标题】:Remove Bootstrap styling for ButtonGroup删除 ButtonGroup 的引导样式
【发布时间】:2021-01-26 10:04:19
【问题描述】:

我想知道是否有办法删除<ButtonGroup> 给出的默认样式/对齐方式。我正在使用 React 和 React Bootstrap 的 <Row><Col><Form.Row>,并且我已经使用 <Col> 进行了样式设置和对齐。 <ButtonGroup> 完全覆盖了这一点,我什么也不能上网。

这是我的图片:

我只在左侧应用了<ButtonGroup>,然后才应用到所有按钮,但它应该仍然像其他按钮一样。

代码:

                        <Col sm={6} xs={6}>
                          <Col style={{ paddingLeft: "0px" }}>
                            {" "}
                            <Form.Label className="button-question">
                              Type of insurance?
                            </Form.Label>
                          </Col>
                          <ButtonGroup>
                            <Row>
                              <Col sm={4} md={3}>
                                <div>
                                  <Button
                                    type="button"
                                    className="orange-btn btn-primary"
                                  >
                                    <i className="fas fa-umbrella fa-2x"></i>
                                  </Button>
                                </div>
                                <Form.Label className="button-label">
                                  Level Term
                                </Form.Label>
                              </Col>
                              <Col
                                sm={4}
                                md={3}
                                style={{ textAlign: "center" }}
                              >
                                <div>
                                  <Button type="button" className="orange-btn">
                                    <i className="fas fa-home fa-2x"></i>
                                  </Button>
                                </div>
                                <Form.Label className="button-label">
                                  Mortgage
                                </Form.Label>
                              </Col>
                              <Col
                                sm={4}
                                md={3}
                                style={{ textAlign: "center" }}
                              >
                                <div>
                                  <Button type="button" className="orange-btn">
                                    <i className="fas fa-heart fa-2x"></i>
                                  </Button>
                                </div>
                                <Form.Label className="button-label">
                                  Whole of Life
                                </Form.Label>
                              </Col>
                            </Row>
                          </ButtonGroup>
                        </Col>

CSS:

.orange-btn {
  width: 73.98px !important;
  height: 60.71px !important;
  cursor: pointer !important;
  color: #FE9900 !important;
  background-color: #ffffff !important;
  border: 1px solid transparent !important;
  border-radius: 10px !important;
  border-color: #FE9900 !important;
  box-shadow: 2px 7px 6px 0 rgba(0, 0, 0, 0.158) !important;
  margin-top: 10px !important;
  margin-bottom: 10px !important;
}

.orange-btn:hover,
.orange-btn:focus {
  color: #ffffff !important;
  background-color: #E89416 !important;
  border-color: #E89416 !important;
  border-radius: 10px !important;
}

.orange-btn:focus {
  outline: 0 !important;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, .25) !important;
}

.orange-btn:active {
  border-color: #FE9900 !important;
  background-color: #FE9900 !important;
  border: 1px solid transparent !important;
}

.button-label {
  font-size: 12px;
  text-align: center;
}

有谁知道这是否可行?

【问题讨论】:

    标签: reactjs bootstrap-4 react-bootstrap buttongroup


    【解决方案1】:

    检查按钮组样式并将默认样式属性赋予内联样式中的按钮组

    【讨论】:

    • 嗯,但我想删除默认样式?
    • 我们不删除默认值我们覆盖默认样式........默认/库给定样式只能通过使用内联样式方法给这些属性提供我们自己的样式或使用类(反应中的类名)属性
    猜你喜欢
    • 2020-04-22
    • 1970-01-01
    • 2018-10-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-28
    • 1970-01-01
    • 2014-09-24
    相关资源
    最近更新 更多