以
标记居中问题(Centering issue with
tag)
我有一个img和一个div内的p 。
我试图垂直居中。 我已经尝试了line-height和其他一些事情。
这是它的样子
我想“可爱的火狐恶作剧”相对于img垂直居中
CSS
img{ width: 50px; height: 50px; } li{ list-style-type: none; text-decoration: none; } a{ text-decoration: none; } li p{ display: inline; color: black; font-size: 25px; margin:0; }DEMO小提琴 。
I have a img and a p inside of a div.
I am trying to center the p vertically. I have tried line-height and a few other things.
Here is what it looks like
I would like "cute firefox prank" to be centered vertically relative to the img
CSS
img{ width: 50px; height: 50px; } li{ list-style-type: none; text-decoration: none; } a{ text-decoration: none; } li p{ display: inline; color: black; font-size: 25px; margin:0; }DEMO fiddle.
最满意答案
完成。
更新了jsFiddle
你所要做的就是添加vertical-align:middle; 到img 。
img { vertical-align:middle; }Done.
Updated jsFiddle
All you have to do is add vertical-align:middle; to the img.
img { vertical-align:middle; }更多推荐
发布评论