https://i.stack.imgur.com/e4Gsv.png
I have a vision of creating something similar to the image above solely using CSS. The design must incorporate the following elements:
- The
image-container
will hold a 3x4 aspect ratio image, filling the available height of the viewport. As a result, the width ofimage-container
will vary based on the viewport height. - The
image-container
should remain fixed in place as the user scrolls through the window. - The
content-container
needs to be scrollable. - The
content-container
should occupy all the space between the right edge ofimage-container
and the right edge of the viewport.
In previous instances, I might have achieved this effect using jQuery:
// style.css
.image-container {
position:fixed;
top: 0px;
left:0px;
bottom: 0px;
}
.image-container img {
height: 100%;
}
// script.js
$(window).load(function() {
var width = $('.image-container').width();
$('.content-container').css({'margin-left': width});
});
Is there a way to achieve this design using only CSS? Perhaps leveraging flexbox?