日期:2013-12-07 浏览次数:21213 次
本帖代码实现的是边框暗影(很多时候被勇于顶部banner框),及让框架内内容垂直居中。
html+CSS实例效果(2):边框为暗影及DIV内容垂直居中效果
<!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=gb2312" />
<title>边框为暗影效果</title>
<style type="text/css">
div {border-width: 1px; border-style: solid; padding: 1px;}
.a {background-color: #F3F3F3; border-color: #FBFBFB;}
.b {background-color: #D8D8D8; border-color: #E8E8E8;}
.c {background-color: #FFF; border-color: #BBB; height: 100px;color:#ff0000;}
.middle-demo-4{ width:300px; border:#FF0000 1px solid; height: 300px; position:absolute; }
.middle-demo-4 div{ border:#009900 1px solid; height:20px; width:300px; position:absolute; margin-top:-10px; top:50%; left:0; }
.middle-demo-4 div div{ border:#330066 1px solid; height:20px; width:300px; margin-top:-12px; margin-left:-2px; position:relative; top: 50%; left:0; }
</style>
</head>
<body>
<div class="a">
<div class="b">
<div class="c">
边框为暗影效果
</div>
</div> </div>
<div class="middle-demo-4">
<div>
<div>
让内容垂直居中
</div>
</div>
</div>
</body>
</html>