<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSS实现DIV内容垂直及水平居中</title>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
<style type="text/css">
#container {width:750px; height:600px; background:#f8f8f8; border:5px solid #777; text-align:center; display:table-cell; vertical-align:middle;}
</style>
<!--[if IE]>
<style type="text/css">
#fixie{width:0;height:100%;display:inline-block;vertical-align:middle;}
#fixiecontainer {text-align:center; width:100%; display:inline-block; vertical-align:middle;}
</style>
<![endif]-->
</head>
<body>
xhtml代码:
<div id="container">
<span id="fixie"></span>
<span id="fixiecontainer">CSS实现DIV内容垂直及水平居中CSS实现DIV内容垂直及水平居中CSS实现DIV内容垂直及水平居中<br /><img src="http://i3.6.cn/cvbnm/fd/79/ff/e64ebebb5d5c547073ff673e060a202f.jpg" alt="" /></span>
</div>
</body>
</html>
css实现内容上下左右居中的效果
最新推荐文章于 2023-07-12 17:33:46 发布