JSFiddle - React, Tailwind, and code Playground
HTML
<div id="mainContent">
<div id="someOtherElem"></div>
<div id="canvasContainer">
<canvas height="300" width="200"></canvas>
</div>
</div>
SCSS
body {
margin: 0;
}
#mainContent {
background: grey;
height: 100vh;
display: flex;
flex-wrap: nowrap;
align-items: center;
}
#someOtherElem {
background: red;
width: 200px;
height: 200px;
margin-left: 1rem;
}
#canvasContainer {
display: flex;
flex: 1;
height: 100%;
justify-content: center;
align-items: center;
}
canvas {
width: calc(100% - 2rem);
height: calc(100% - 2rem);
background: green;
object-fit: contain;
}