【问题标题】:React Bootstrap: Align col so that the col on the right will be displayed on top of the col on the leftReact Bootstrap:对齐 col 使右侧的 col 显示在左侧 col 的顶部
【发布时间】:2021-07-08 19:40:48
【问题描述】:

我想知道 React Bootstrap 是否有一种方法可以将两列并排显示,但是当屏幕变小时,将右侧的列显示在左侧列的顶部,而不是相反.

这是我的代码:

import "./styles.css";
import Row from "react-bootstrap/Row";
import Col from "react-bootstrap/Col";
import Card from "react-bootstrap/Card";

import "bootstrap/dist/css/bootstrap.min.css";

export default function App() {
  return (
    <div className="App">
      <Row>
        <Col sm={8}>
          <Card>
            <Card.Body>
              <Card.Title>Left Card/Bottom Card</Card.Title>
              <Card.Text>
                Some quick example text to build on the card title and make up
                the bulk of the card's content.
              </Card.Text>
            </Card.Body>
          </Card>
        </Col>
        <Col sm={4}>
          <Card>
            <Card.Body>
              <Card.Title>Right Card/Top Card</Card.Title>
              <Card.Text>
                Some quick example text to build on the card title and make up
                the bulk of the card's content.
              </Card.Text>
            </Card.Body>
          </Card>
        </Col>
      </Row>
    </div>
  );
}

另外,这是codesandbox的链接

【问题讨论】:

    标签: css reactjs twitter-bootstrap react-bootstrap bootstrap-5


    【解决方案1】:

    是的,使用订单类..

           <Container className="App" fluid={true}>
              <Row>
                <Col sm={8} className="order-last order-sm-first">
                  <Card>
                    ...
                  </Card>
                </Col>
                <Col sm={4}>
                  <Card>
                    ...
                  </Card>
                </Col>
              </Row>
           </Container>
    

    Codeply

    【讨论】:

    • 太棒了!这就是我要找的,谢谢!
    猜你喜欢
    • 2017-07-15
    • 2016-10-25
    • 2019-12-09
    • 1970-01-01
    • 1970-01-01
    • 2016-03-16
    • 2017-12-28
    • 2023-01-17
    • 1970-01-01
    相关资源
    最近更新 更多