简体   繁体   中英

Vertically align span with image inside div

Please see fiddle and do not change id "darko" I need it as it is.

http://jsfiddle.net/2PSNN/4/

Here you go:

#darko {
text-align: center;
vertical-align : middle;
border: 2px solid red;
}
#darko > * {
vertical-align : middle;
}
#darko1 {
margin: auto 0;
border: 2px solid green;
display: inline-block;
}
#darko2 {
margin: auto 0;
border:2px solid yellow;
}

http://jsfiddle.net/2PSNN/3/

Try if this works for you fiddle

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM