css - vertical-align:top 对齐
本文介绍了css - vertical-align:top 对齐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
帮我看下这个span的垂直对齐,为什么没有上对齐呢?
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>font-test</title>
<style>
* {padding: 0; margin: 0}
p {font: bold 30px 'Microsoft JhengHei UI'; line-height: 50px; }
span {vertical-align: top; font-size: .5em;}
</style>
</head>
<body>
<p> This is a test<span> span</span></p>
</body>
</html>
这是效果
如果把line-height换成1.5就没问题,不知道问题出在哪里,求解答
解决方案
就是继承了p的行高
这篇关于css - vertical-align:top 对齐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文