Playing with React Bootstrap I'm unable to get my SVG to center vertically. The component:
ComingSoon.js:
import React from 'react'
import { Container, Row, Col, Image } from 'react-bootstrap'
// SVG
import comingSoonSVG from './coming-soon.svg'
const ComingSoon = () => {
return (
<Container className="h-100">
<Row className="align-items-center">
<Col md={{ span: 8, offset: 2 }}>
<Image src={comingSoonSVG} alt="Coming Soon" />
</Col>
</Row>
</Container>
)
}
export default ComingSoon
app.js:
import React from 'react'
import 'bootstrap/dist/css/bootstrap.min.css'
// Components
import ComingSoon from './components/ComingSoon'
const App = () => {
return (
<>
<ComingSoon />
</>
)
}
export default App
Per my research this should work based on:
You can apply any of Bootstrap's classes to a React Bootstrap component. *
so I referenced Vertical alignment and even added and removed row from <Row className="row align-items-center">
but it still will not work.
Reading other Q&As I've read:
- Bootstrap Vertical Align Image (Think this is Bootstrap 3 and not 4)
- React Bootstrap - how to center image vertically in a row when using
<Row className="justify-content-md-center row">
it doesn't vertically center the image and throws it to the right slightly.
Other reads:
Found no solution or examples in the docs.
In React Bootstrap how can I vertically align an image in a column?