Apr
30
怎样让你的网页内容在不同尺寸和不同分辨率的显示器下显示都是上下左右居中的呢?或许下面这段代码能够帮到你,关键参数是#innerWrap里的设置。
如果不懂怎样操作就留言给我
<!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>让你的网页内容上下左右都居中</title>
<style type="text/css">
<!--
body{margin:0;padding:0;background:#5a0026;font-family:"宋体",Arial,Tahoma;font-size:12px;text-align:center;}
/*全局设置*/
#wrap{margin:0 auto;padding:0 inherit;width:100%;overflow:hidden;background:#eee;}
#innerWrap{width:500px;height:300px;border:1px solid #999;background:#ccc;position:absolute;top:50%;left:50%;margin:-150px 0 0 -250px;line-height:300px;text-align:center;}
-->
</style>
</head>
<body>
<div id="wrap">
<div id="innerWrap">这里是你的主体部分</div>
</div>
</body>
</html>
如果不懂怎样操作就留言给我
<!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>让你的网页内容上下左右都居中</title>
<style type="text/css">
<!--
body{margin:0;padding:0;background:#5a0026;font-family:"宋体",Arial,Tahoma;font-size:12px;text-align:center;}
/*全局设置*/
#wrap{margin:0 auto;padding:0 inherit;width:100%;overflow:hidden;background:#eee;}
#innerWrap{width:500px;height:300px;border:1px solid #999;background:#ccc;position:absolute;top:50%;left:50%;margin:-150px 0 0 -250px;line-height:300px;text-align:center;}
-->
</style>
</head>
<body>
<div id="wrap">
<div id="innerWrap">这里是你的主体部分</div>
</div>
</body>
</html>
根据判断浏览器类型屏幕分辨率自
代理登陆IP列表




一直没见你更新文章 这里难道要荒废了?
这个方法固定了层的大小,如果是长宽不定的层就不能用这个方法了。