My idea is to have the image take the rest of the available viewport height after subtracting the height of the header. For example, if my viewport is 1000px height and my header is 100px height to make the image's height to 900px.
In the example below, I've set the max-height
of the image to 100vh, however, since there's a header as well, a scrollbar appear to the side. I'm trying to make the max-height
of the image be viewport minus header. Is it correct to assume this is done with JavaScript? Any tips or pointers to use in order to figure out how to do it?
*, *:after, *:before {
margin: 0;
padding: 0;
-webkit-box-sizing: border-box;
box-sizing: border-box;
text-decoration: none;
}
a {
color: #f1f1f1;
}
html {
font-size: 16px;
}
body {
background-color: #fafafa;
font-family: 'Roboto', sans-serif;
height: 100%;
width: 100%;
}
.navigation {
background-color: #171717;
}
.navigation-ul {
display: flex;
}
.navigation-ul>li:not(.dropdown) {
padding: 15px 13px 15px 13px;
font-weight: 500;
text-align: center;
font-size: 1em;
color: white;
background-color: #151719;
list-style-type: none;
}
.specific-image-flexbox {
display: flex;
}
.specific-image-column {
flex: 4;
}
.specific-image-container {
text-align: center;
width: 100%;
}
.specific-image {
display: block;
max-height: 100vh;
max-width: 100%;
margin: 0 auto;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<nav class='navigation'>
<div class="wrapper">
<ul class="navigation-ul">
<li><a href="">Images</a></li>
<li><a href="">Albums</a></li>
</ul>
</div>
</nav>
<div class="specific-image-flexbox">
<div class="specific-image-column">
<div class='specific-image-container'>
<img class='specific-image' src='https://odysseyonline-img.rbl.ms/simage/https%3A%2F%2Faz616578.vo.msecnd.net%2Ffiles%2F2016%2F07%2F18%2F636044656439844367681973023_453768-cats-cute.jpg/2000%2C2000/UWdtxOCqm5JAgBMr/img.jpg' alt='Random image' />
</div>
</div>
</div>