六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 26|回复: 0

one div as the other one's background

[复制链接]

升级  80.67%

51

主题

51

主题

51

主题

秀才

Rank: 2

积分
171
 楼主| 发表于 2013-2-7 15:00:43 | 显示全部楼层 |阅读模式
method 1
<!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>
  <title> new document </title>
  <meta name="generator" content="editplus" />
  <meta name="author" content="" />
  <meta name="keywords" content="" />
  <meta name="description" content="" />
  <style type="text/css">
  <!--
.top{height:200px;width:300px;background:#FF0000;z-index:11;position:absolute;}
.back{height:200px;width:300px;background:#00FF00;position:absolute;z-index:0;}

  -->
  </style>
</head>

<body>
<div class="top"></div>
<div class="back"></div>
</body>
</html>
method 2

<!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>
  <title> new document </title>
  <meta name="generator" content="editplus" />
  <meta name="author" content="" />
  <meta name="keywords" content="" />
  <meta name="description" content="" />
  <style type="text/css">
  <!--
.back{height:200px;width:300px;background:#00FF00;}
.top{height:200px;width:300px;background:#FF0000;margin-top:-200px;}

  -->
  </style>
</head>

<body>
<div class="back"></div>
<div class="top"></div>
</body>
</html>
method 3
<!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>
  <title> new document </title>
  <meta name="generator" content="editplus" />
  <meta name="author" content="" />
  <meta name="keywords" content="" />
  <meta name="description" content="" />
  <style type="text/css">
  <!--
.back{height:200px;width:300px;background:#00FF00;}
.top{height:200px;width:300px;background:#FF0000;position:absolute;}

  -->
  </style>
</head>
<body>
<div class="top"></div>
<div class="back"></div>
</body>
</html>
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表