starting from this question I have created the following layout:
html, body {
height: 100%;
}
.flexcontainer {
height: 100%;
display: flex;
flex-direction: row;
}
.left-container {
flex: 3 0 0;
}
.left-container .header {
display: flex;
}
.right-container {
flex: 1 0 0;
}
.right-container img {
height: 100%;
width: 100%;
object-fit: contain;
object-position: top right;
}
<div class="flexcontainer">
<div class="left-container">
<div class="header">
<div class="avatar">
<img src="https://i2.wp.com/oneword365.com/wp-content/uploads/oph-Avatar.png?resize=73%2C73"/>
</div>
<div class="user">
<span class="title">Sue Smith</span>
<div class="subtitle">PincoPallino</div>
<div class="time">15th August 2017</div>
</div>
</div>
<div class="text">
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas vel porttitor risus. Integer dictum massa ac mollis posuere. Etiam dapibus odio euismod lacus tempus tempor. Donec sagittis eget purus non rhoncus. Ut ac est turpis. Ut et ornare felis. Vestibulum at facilisis sed.
</div>
</div>
<div class="right-container">
<img src="http://www.fulltimefba.com/wp-content/uploads/2014/04/bigstock-obstacle-ahead-caution-for-dan-41515888.jpg"/>
</div>
</div>
(CodePen mirror).
I would like to have that the image on the right should fit the above the fold section, and even have some padding arount it. As you can see it can't and a vertical scrollbar appears.
How can i fit the image to the above the fold?
If I set padding
and margin
of body
to 0
it works and I get rid of the vertical scroll bar. But... isn't this a dirty solution?