1

I am using react bootstrap trying to display a simple 2x2 grid. This should work fairly simply, but both the columns and the rows display vertically on all screen sizes. It is supposed to look like this:

A B
A B

but instead looks like this:

A
B
A
B

Here is the code:

import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import Home from './Home.js';
import * as serviceWorker from './serviceWorker';
import CustomNavBar from './CustomNavBar.js';

import { Col, Row, Grid, DropdownButton, Button} from 'react-bootstrap';

const grid = (<div style={{backgroundColor: '#801903', color: '#ffff'}}>
  <Grid>
    <Row sm={12}>
      <Col sm={6}>A</Col>
      <Col sm={6}>B</Col>
    </Row>
    <Row sm={12}>
      <Col sm={6}>A</Col>
      <Col sm={6}>B</Col>
    </Row>
  </Grid>

</div>);

ReactDOM.render(grid, document.getElementById('root'));

serviceWorker.unregister();

Output:

1 Answer 1

0

Did you import the css for react-bootstrap in you html page?

<link
  rel="stylesheet"
  href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css"
  integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T"
  crossorigin="anonymous"
/>
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.