本帖代碼實現的是邊框陰影(很多時候被勇於頂部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>