css3 - Issue with scaling width of background-image (CSS) -
i'm havig troubles image that, using "contain" in css adds huge spacing between top image , next paragraph. when use "cover" there no spacing issue pictures width high.
i'm using in css
.headerline{ position: relative; width: 100%; overflow: hidden; height: auto; background-repeat: no-repeat; background-position: center top; background-image: url(../images/bgtop.jpg); -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: contain;
i upoaded pictures 100% desktop, using cover, using contain , 1 wished results here: description
have considered including image <img>
instead of background image? cause headerline div dynamically change height match child image.
html:
<div class="headerline"> <img src="sampleimg.jpg" alt="sample image" width="600" height="200"> </div>
css:
.headerline img { display: block; width: 100%; height: auto; }
concerning background size w3 schools:
background cover:
scale background image large possible background area covered background image. parts of background image may not in view within background positioning area background cover scale image
background contain:
scale image largest size such both width , height can fit inside content area
Comments
Post a Comment