I'm working on adjusting the height of elements on my page
https://i.sstatic.net/tqRs9.png
My goal is to dynamically change the height of A
and B
based on screen height so they always fit within a single screen without requiring scrolling.
Currently, I am using media queries to customize the height of my elements.
@media screen and (min-width: 1920px) and (max-width: 5000px) {
.A{
height: 600px;
}
.B{
margin-right: 400px;
}
}
@media screen and (min-width: 1279px) and (max-width: 1919px) {
.A{
height: 550px;
}
.B{
height: 350px;
}
However, this method feels cumbersome as I'd like the heights of A
and B
to adapt automatically based on current screen size without having to create numerous media queries for each possible dimension.
Is there a more efficient solution for achieving this?