css - why child element <img /> not contains in the parent div width and height? -
everyone try css style below:
.image{ position: absolute; width: 100px; height:100px; padding: 5px; margin: 0; background-color:green; } <div class="image"> <img src="http://www.wallpapersgo.com/wp-content/uploads/2010/02/dodge-charger-car.jpg"/> </div>
the problem is, showing image same size is, not in expected size 100px * 100px. fresh in css style, need , thx!
use:
.image{ position: absolute; width: 100px; height:100px; padding: 5px; margin: 0; background-color:green; } .image img { width: inherit; height:inherit; }
Comments
Post a Comment