I am trying to get a <img>
to expand to fill the height of its parent, using max-height
. This image will act as a banner image.
My problem is that if a larger height is set, the image does not fill it completely, maintaining its aspect ratio.
https://jsfiddle.net/f5bpz16r/2/
body {
width: 100%;
margin:0;
padding:0;
}
nav {
width: 155px;
height: 100%;
position: fixed;
top: 0;
right: 0;
bottom: 0;
z-index: 10;
border-left: 1px solid #000
}
nav > .nav-area {
width: 155px;
height: 100%;
position: relative;
}
nav > .nav-area > a.logo {
position: absolute;
top: 100px;
left: 15px;
-webkit-transform: rotate(-90deg);
-ms-transform: rotate(-90deg);
transform: rotate(-90deg);
height: 80px;
width: 187px;
}
.wrap {
margin-right: 155px;
}
.wrap .inner-wrap {
padding: 45px 55px 0 55px
}
header > .small,
header > .medium,
header > .large,
header > .x-large {
overflow:hidden
}
header img {
width:100%
}
header > .small {
max-height: 377px
}
header > .medium {
max-height: 532px
}
header > .large {
max-height: 884px
}
header > .x-large {
max-height: 1082px
}
<div id="container">
<nav>
<div class="nav-area">
<a class="logo" href="/">
LOGO
</a>
</div>
</nav>
<div class="wrap">
<header>
<div class="large">
<img src="https://static.pexels.com/photos/461775/pexels-photo-461775.jpeg" alt=""/>
</div>
</header>
<main>
<div class="inner-wrap">
Wrap
</div>
</main>
</div>
</div>
The <img
> is plenty big enough. At 4000px high.