首页 > Web开发 > 详细

css实现ie6以上文字高度未知垂直居中

时间:2016-05-17 09:54:40      阅读:258      评论:0      收藏:0      [点我收藏+]
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible"content="IE=edge,chrome=1">
	<title>Examples</title>
	<meta name="description"content="">
	<meta name="keywords"content="">
	<link href=""rel="stylesheet">
	<style>

body {
	padding: 0;
	margin: 0;
}
.content {
	border: 1px solid red;
	width: 500px;
	margin: 0 auto;
	font-size: 12px;
	line-height: 1.8;
}

/*标准游览器版本*/
html, body {
	height: 100%;
}
.wrapper {
	text-align: center;
	width: 100%;
	height: 100%;
	display: table;
}
.subwrap {
	display: table-cell;
	vertical-align: middle;
}

/*IE6*/
*html .wrapper {
	position: absolute;
	top: 50%;
	width: 100%;
	text-align: center;
	display: block;
	height: auto
}
*html .subwrap {
	position: relative;
	top: -50%;
	text-align: center;
}

/*IE7 可以合并 但是为了更好说明 没有合并*/
*+html .wrapper {
	position: absolute;
	top: 50%;
	width: 100%;
	text-align: center;
	display: block;
	height: auto
}
*+html .subwrap {
	position: relative;
	top: -50%;
	text-align: center;
}
</style>
</head>
<body>
	<div class="wrapper">
		<div class="subwrap">
			<div class="content">
				关于 CSS 的未知高度水平垂直居中问题的未知高度水平垂直居中问题的未知高度水平垂直居中问题的未知高度水平垂直居中问题的未知高度水平垂直居中问题
				<br />
			</div>
		</div>
	</div>
</body>
</html>

  

css实现ie6以上文字高度未知垂直居中

原文:http://www.cnblogs.com/bestsamcn/p/5500304.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!