image - Incorrect CSS Button Height computing -


i created example showing current issue have styling button contains image:

example (sorry, not allowed post images yet)

the height of image (img) 32 pixels, height of surrounding button 34 pixels , height of surrounding div 36 pixels.

where additional pixels come from?! want these buttons have height of 32 pixels , rid of space in between 2 buttons. not want set specific height buttons (e.g. 32px). should adapt size of content (image, text).


index.html

<!doctype html> <html >     <head>         <meta charset="utf-8"/>         <style type="text/css">             div {                 border: 0;                 margin: 0;                 padding: 0;             }             button {                 border: 0;                  padding: 0;                  margin: 0;             }         </style>     </head>     <body>         <div>             <button><img src="img/site/buttons/32x32/add_user.png"> benutzer hinzufügen</button>         </div>         <div>             <button><img src="img/site/buttons/32x32/add_user.png"> benutzer hinzufügen</button>         </div>     </body> </html> 

the space comes vertical-alignment of image.

try this:

img {      display:inline-block;      vertical-align:middle;  } 

see fiddle


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -