0

Can someone please shed some light on this for me ... No matter what I do with the below code I always seem to have three columns but I just want two .. What I mean is the way the below shows on my page it is expecting another one to the right .. so it does not look like this

COL 1 ..... SPACE HERE........ COL 2

But instead

COL 1 COL 2

    <Row className="show-grid text-center">
      <Col xs={12} sm={4} className="person-wrapper">
        <Image src="assets/image.jpg" circle className="profile-pic"/>
        <h3></h3>
      <Link to="/place">
        <Button bsStyle="primary">click</Button>
      </Link>
      </Col>
      <Col xs={12} sm={4} className="person-wrapper">
        <Image src="assets/image1.jpg" circle className="profile-pic"/>
        <h3></h3>
      <Link to="/place">
        <Button bsStyle="primary">click</Button>
      </Link>
      </Col>
    </Row>
3
  • You've written I want COL1 COL2 But instead getting COL1 COL2 , okay so what's the difference? Commented Mar 20, 2019 at 8:41
  • sorry format was not correct .. I will edit Commented Mar 20, 2019 at 10:37
  • Try sm={{ span: 4, offset: 4 }} on the second <Col>. Source : react-bootstrap.github.io/layout/grid/#responsive-grids Never used Bootstrap with ReactJS so I don't know if it'll work. Tell us if it works or not ! Commented Mar 20, 2019 at 10:43

2 Answers 2

2

You should set an offset to each "resolution" you want to cover, in your case for sm:

<Row className="show-grid text-center">
  <Col xs={12} sm={4} className="person-wrapper">
    {/* your content goes here */}
  </Col>
  <Col xs={12} sm={{ span: 4, offset: 4 }} className="person-wrapper">
    {/* your content goes here */}
  </Col>
</Row>
Sign up to request clarification or add additional context in comments.

Comments

0

The grid contains 12 columns, not 8. Your two sm columns need to add up to 12. Use sm={6} instead of sm={4}

<Row className="show-grid text-center">
  <Col xs={12} sm={6} className="person-wrapper">
    <Image src="assets/image.jpg" circle className="profile-pic"/>
    <h3></h3>
  <Link to="/place">
    <Button bsStyle="primary">click</Button>
  </Link>
  </Col>
  <Col xs={12} sm={6} className="person-wrapper">
    <Image src="assets/image1.jpg" circle className="profile-pic"/>
    <h3></h3>
  <Link to="/place">
    <Button bsStyle="primary">click</Button>
  </Link>
  </Col>
</Row>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.