1

I am using react bootstrap with Container, Row, Col components. My code is not working, I am expecting columns but they are appearing one after the another like rows.

Code ->

import React from "react";
import Container from "react-bootstrap/Container";
import Row from "react-bootstrap/Row";
import Col from "react-bootstrap/Col";

function Header() {
  return (
    <Container>
      <Row>
        <Col xs={4} md={4} lg={4} sm={4}>
          First
        </Col>
        <Col xs={4} md={4} lg={4} sm={4}>
          Second
        </Col>
        <Col xs={4} md={4} lg={4} sm={4}>
          Third
        </Col>
      </Row>
    </Container>
  );
}

export default Header;

enter image description here

1
  • 1
    import 'bootstrap/dist/css/bootstrap.min.css'; -codesandbox Commented Jun 21, 2021 at 14:46

1 Answer 1

2

Stylesheets#

Because React-Bootstrap doesn't depend on a very precise version of Bootstrap, we don't ship with any included CSS. However, some stylesheet is required to use these components.

CSS#

{/* The following line can be included in your src/index.js or App.js file*/}

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

Source: https://react-bootstrap.github.io/getting-started/introduction

Example provided by react-bootstrap: https://codesandbox.io/s/github/react-bootstrap/code-sandbox-examples/tree/master/basic?file=/src/App.js

Sign up to request clarification or add additional context in comments.

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.