I have a backend where I can choose dynamically between two block elements one for images and one for text. I want to create flexible layouts for example:
____________________
|__image__|__text __|
|__text __|__image__|
|__text __|__text __|
|__image__|__image__|
and so on… Now my Problem is that I want the textblock to fit my grid row and the image block to take 50% of window width. like so:
My Structure is like this at the moment but I can change it easy if necessary, the only thing I want to use is the div with background-image
. For this div im using cover css property
-webkit-background-size: cover!important;
-moz-background-size: cover!important;
-o-background-size: cover!important;
background-size: cover!important;
background-position: center center;
background-repeat: no-repeat;
<section class="section textimgblock row fullWidth small-collapse">
<div class="columns medium-6">
<div class="rich-text">SOME TEXT</div>
</div>
</div>
<div class="columns medium-6 bgimg" style="background-image:url('/media/images/3_1RSSWbZ.width-800.jpg');">
</div>
</section>
Is there a clean css/html method for doing this or should i use javascript? regards Manuel