css - div height overstretching when image is appended -


i'm having problem nested divs , height.

what want accomplish image's parent's height stretch fit image. happening parent overstretching , height bigger image.

you can check code working here: http://jsfiddle.net/83ke6/

html

<div class="select_box">     <div class="selected">         <img src="http://awardwallet.com/images/fbsmalllogo.png" />     </div> </div> 

css

.select_box {     display:inline-block;     height:50px;     border:1px solid blue; } .selected {     border:1px solid gray; } img {     border:1px solid red; } 

so on case, .selected should equal img height, 5px heigher; help

by default img inline element , therefore reserves space under lines in paragraph. add display: block; image remove spacing.

fiddle: http://jsfiddle.net/83ke6/3/


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -