HTML image and div resize -
.d1 { background-color: red; text-align: center; } <div class="d1"> <img src="http://www.aliceseelywholesale.net/wp-content/uploads/adb101-daisy-cutout-narrow-link-bracelet-300x100.jpg"> </div>
i use above simple code display image
in middle div
. code works when resize window below width of image, border/div doesn't cover image... there way fix this? ty
if want use backgound image <div>
suggest set image background-image
div, , remove <img>
element.
this save using addition element , fix problem:
.d1 { width:300px; height:100px; background-color: red; text-align: center; background-image: url(http://www.aliceseelywholesale.net/wp-content/uploads/adb101-daisy-cutout-narrow-link-bracelet-300x100.jpg); background-size:cover; }
<div class="d1"> </div>
Comments
Post a Comment