[英]image and text not aligning in the middle?
Add img{float:left}
and div.topHeader{line-height:70px}
. 添加
img{float:left}
和div.topHeader{line-height:70px}
。
In fact, using line-height
equal to the height of your div will center a one-lined text (and the image) vertically. 实际上,使用等于您的div高度的
line-height
将使line-height
文本(和图像)垂直居中。 Just don't forget to make your image to float in order to write text in the same line as the image. 只是不要忘记使图像浮动以在与图像相同的行中写入文本。 A Fiddle.
小提琴。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.