CSS样式position属性的一个小实例:z方向三层布局分

网站建设 2023-01-28 20:49www.1681989.com免费网站
CSS样式position的一个小实例代码如下

复制代码
代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://.w3./TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://.w3./1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>CSS样式position的一个小实例z方向三层布局-成功志(.ok12.)</title>
</head>
<body>
<div style="width:400px; height:400px; background:#666; border:#9FF 1px solid;marg:0 auto; color:#9FF ">
我是最底层
<div style="position:relative; background:#969;width:300px; height:300px; border:1px #fff solid ;marg:0 auto; marg-:30px; color:#fff">
<div style="width:300px; height:300px; background:#099; marg:0 auto; ">我是中间层</div>
<div style="position:absolute; :0; width:100px; height:100px; background:#CCF; marg:100px; color:#444; border:#444 1px solid">我是最顶层</div>
</div>
</div>
</body>
</html>

最终效果

另一个示例

复制代码
代码如下:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://.w3./TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://.w3./1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>另一个展示</title>
</head>
<body>
<div style="width:220px; height:220px;background:#369; paddg:10px">
<div style="position:relative;marg:10px;">
<div style="background:#CCC; width:200px; height:200px; "></div>
<div style="background:#666; width:180px; height:180px; position:absolute; :0; marg:10px">
<div style="width:160px; height:160px; background:#f00; marg:10px"></div></div>
</div>
</div>
<div><embed src="http://static.youku./v1.0.0149/v/swf/qplayer_rtmp.swf?XNDQ1NzEzNjgw&wType=adshow&isAutoPlay=true" quality="high" width="宽度" height="高度" align="middle" type="application/x-shockwave-flash"></embed></div>
</body>
</html>

Copyright © 2016-2025 www.1681989.com 推火网 版权所有 Power by