CSS样式之行高

CSS样式之行高


<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<style type="text/css">
			/*
			 * 浏览器默认文字大小:16px
			 * 行高=文字高度+上下边距
			 * 行高:是基线与基线之间的距离
			 * 一行文字行高和父元素高度一致的时候,垂直居中显示。
			 * 
			 * 行高的单位	文字大小	值
			 * 20px 	20px 	20px
			 * 2em 		20px    40px
			 * 150% 	20px 	30px
			 * 2 		20px 	40px
			 * 
			 * 总结:单位除了像素以为,行高都是与文字大小乘积。
			 * 总结:不带单位时,行高是和子元素文字大小相乘,em和%的行高是和父元素文字大小相乘。行高以像素为单位,就是定义的行高值。
			 * 推荐行高使用像素为单位。
			 */
			
			body {
				text-align: center;
			}
			
			a {
				display: inline-block;
				height: 58px;
				width: 120px;
				text-align: center;
				text-decoration: none;
				line-height: 50px;
			}
			
			a.one {
				background: url(../../img/bg1.png);
			}
			
			a.two {
				background: url(../../img/bg2.png);
			}
			
			a.three {
				background: url(../../img/bg3.png);
			}
			
			a.four {
				background: url(../../img/bg4.png);
			}
			
			a.five {
				background: url(../../img/bg5.png);
			}
			
			a:hover {
				background: url(../../img/bg7.png);
			}
		</style>
	</head>

	<body>
		<a href="" class="one">五彩导航</a>
		<a href="" class="two">五彩导航</a>
		<a href="" class="three">五彩导航</a>
		<a href="" class="four">五彩导航</a>
		<a href="" class="five">五彩导航</a>
	</body>

</html>


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值