【发布时间】:2020-06-15 20:51:25
【问题描述】:
我有一个 React 应用程序,并且正在使用 Reactstrap 来设置我的组件的样式。我想要一个Card 以我的Container 的全宽运行,所以我将col-md-6 类用于CardBody 的两个不同部分,但它仍然垂直堆叠而不是水平堆叠。我希望价格和“选择”按钮与产品标题和描述并排。我的 index.html 文件中有 bootstrap cdn,我知道它已连接,因为我的应用程序的其他组件中有 Bootstrap 类。谁能帮我弄清楚如何让它水平堆叠?
我的代码:
// component is wrapped in a <Container> in the parent component
<Row>
<Card>
<Col className="col-6">
<CardBody>
<h5>Product title</h5>
<CardText>Some quick example text to build on the product title and make up the bulk of the card's content.</CardText>
</CardBody>
</Col>
<Col className="col-6">
<CardBody>
<h6>Price: { cost }</h6>
<Button color="success" size="lg" onClick={ handleSelection }>Select</Button>
</CardBody>
</Col>
</Card>
</Row>
【问题讨论】:
标签: reactjs bootstrap-4 reactstrap