As you can see by this codepen even if I set text-align: center;
the image is right, but the text is on the bottom. How do I make it vertically aligned to the middle of the image.
* { margin: 0; padding: 0; } #header { width: 100%; height: auto; position: fixed; top: 0px; background-color: black; color: white; text-align: center; }
<div id="header"> test <img src="../immagini/logo.png" height="100px" style="padding: 0px 20px">test </div>
This is ridiculously easy. Just use this:
img {
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.