jquery - CSS with background image and a little content -


i have background image going overlay testimonial in near lower right. having hard time work responsive design. have image 930x454 want show entire image. tried set min-width , min-height , can work when shrink window wider screen. ideally want image not exceed 100% width of screen size. content 3 sentences not come close taking 930x454.

do need write resize function or there easy css solution this.

two key concepts important here: positioning (in case relative on parent , absolute on text box), , background-size. i'll leave google those.

.background {    background-image: url('http://lorempixel.com/930/454/nature');    background-size: cover;    height: 0;    padding-bottom: 56.25%;    max-width: 100%;    position: relative;  }  .text {    position: absolute;    right: 20px;    bottom: 20px;    background: rgba(255,255,255,.3);    padding: 20px;  }
<div class="background">    <div class="text">some text.</div>  </div>

fiddle demo


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -