I want the space between my black div and the navbar to remain the same when I resize the window. I thought of resizing the margin-top as the window gets smaller but I do not know how to get window's current size and use it in css.
Photos:
Question.css
.Question {
background-color: #0B0C10;
margin: 2% 5% 3% 5%;
padding: 4%;
color: #C5C6C7;
}
Question.js
import React from 'react'
import './Question.css'
class Question extends React.Component {
render() {
return (
<div className='Question'>
applications of adaptive testing, starting with Binet in 1905. Adaptive tests are comprised of items
selected from a collection of items, known as an item bank. The items are chosen to match the
estimated ability level (or aptitude level, etc.) of the current test-taker. If the test-taker succeeds on
an item, a slightly more challenging item is presented next, and vice-versa.
</div>
)
}
}
export default Question;
NavBar.css
.NavBar {
background-color: #0B0C10;
position: fixed;
top: 0;
width: 100%;
border-bottom: 2px solid #C5C6C7;
color: #C5C6C7;
}
.Title {
margin-left: 5%;
}
NavBar.js
import React from 'react'
import './NavBar.css'
class NavBar extends React.Component {
render() {
return (
<div className='NavBar'>
<h3 className='Title'>CATlin</h3>
</div>
)
}
}
export default NavBar;
Thank you in advance!