JavaScript solution
I know this is not a CSS-only solution. I use JavaScript, but this may help as a temporary solution when we look for a CSS article.
HTML will be the same as you posted:
<div id="hungry"> <div class="col-xs-offset-6 col-xl-offset-6 col-xs-6 col-xl-6"> <p>Hungry doesn't always happen in the kitchen</p> </div> </div>
CSS for a div with id "hungry" would look like this:
#hungry { background:url('http://i.stack.imgur.com/7xasp.jpg') no-repeat center center ; background-size:cover; width:100%; }
And finally, with JavaScript (I used jQuery to simplify), you resize #hungry depending on the screen width:
// you know the size for your image imageWidth = 1919; imageHeight = 761; imageProportion = imageHeight/imageWidth; function resizeJumbo() { $("#hungry").css({ height: $(window).width() * imageProportion }); } $(window).on("resize", function() { resizeJumbo(); }); $(document).ready(function() { resizeJumbo(); });
You can see the demo that is working on this script: http://jsfiddle.net/hyfz0Lga/ .
CSS only solution
Just update the CSS for the hungry div a bit:
#hungry { background:url('http://i.stack.imgur.com/7xasp.jpg') no-repeat center center ; background-size:cover; width:100%; padding-top:20%; padding-bottom:20%; }
You can see how it works here: http://jsfiddle.net/hyfz0Lga/1/ .
Why padding-top:20% and padding-bottom:20% ?
These values ββare related to the size of the image and the proportion between them. In your case: width = 1919 and height = 761, so the ratio between width and height (761/1919) * 100 = 39.65%. Just add half of this value above and half this value below, then the text will always remain in the middle, and the image will always be proportional.
I know this is a bit βhackedβ and plays with some data understanding, but it seems to work quite well.