这里的图片和文字设置了z-index,但是无法使文字浮于图片上方
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS布局</title>
<style type="text/css">
*{
margin: 0;
padding:0;
font-family:"Microsoft YaHei UI";
}
.header,.footer{background-color: #07cbc9;
width: 100%;height:80px;
line-height: 80px;color: #ffffff;
}
.footer{text-align: center;position: absolute;
bottom: 0; margin-top:80px;}
.logo{float: left;padding-top: 15px;}
.nav{float:right;padding-right: 100px;}
.nav ul li{ float: left;list-style: none;
padding-right: 20px;
}
.banner{width: 100%; overflow: hidden;
height: 635px;}
.banner .tu{width: 100%;height:635px;position: absolute;
top: 80px;
}
.banner img{width: 100%;height: 635px;}
.banner .toplayer{background-color: #000;width: 100%;
height:635px;
opacity:0.5;position: absolute;
top: 80px;
}
.banner .form{text-align: center;
height: 400px;width:800px;
position: absolute;
z-index: 2;top:50%;
left:50%;margin-top: -300px;
margin-left: -400px;
}
.banner .form .border{
background-color: transparent;
border: solid 1px white;height: 30px;
padding: 10px;
}
.banner .form .textarea{ background-color: transparent;
border: solid 1px white;color:#808080;
padding: 10px;padding: 10px;}
button{color:#808080;}
.clear{clear: both;}
.tou dt{font-weight: bolder;font-size: 30px;text-align: center;}
hr{border:1px solid #07cbc9;width: 25px;text-align:center;margin:7px auto 0;}
.tou dd{text-align: center;color:#808080;}
.about .small {overflow: hidden;height: 500px;}
.about .small .left,.middle,.right{float: left;padding: 20px;}
.about .small .left{margin-left: 450px;}
.about .small .left .l1{font-weight: bold;font-size: 22px;}
.about .small .left .l2{border: #808080 solid 1px;padding: 20px;background-color: transparent;font-size: 10px;height: 160px;}
.about .small .left .l2 .special{color: white;background-color: black;width: 100px;height: 50px;}
.about .small .middle{width: 600px;position: relative;left: -135px;}
.about .small img{height: 280px;width: 600px;z-index: -2;}
.about .small .right .r1,.r2{border: #07cbc9 solid 1px;width: 200px;height: 100px;text-align: center; margin-left: -150px;padding-top: 20px;padding-bottom: 0px;}
.about .small .right .r1{margin-bottom: 25px;}
.about .small .right .num{font-weight: bold;font-size:22px;}
.about .small .right .q{font-size:15px;}
</style>
</head>
<body>
<div class="header">
<div class="logo">
<img src="images/logo.png">
</div>
<div class="nav">
<ul>
<li>HOME</li>
<li>ABOUT</li>
<li>FACULTY</li>
<li>GALLERY</li>
<li>EVENTS</li>
<li>CONTACT</li>
</ul>
</div>
</div>
bananer
<div class="about">
<div class="tou">
<dl>
<dt>ABOUT</dt>
<hr>
<dd>
Lorem Ipsum is simply dummy text of the printing and typesetting <br>industry.Lorem Ipsum has been the industry's standard dummy<br> text ever since the 1500s.
</dd>
</dl>
</div>
<div class="small">
<div class="left">
<div class="l1"> A WORLD <br> ABOUT US</div>
<div class="l2">Praesent dignissim viverra est,sed<br>bibendum ligula congue non.Sed ac nisl<br>et felis gravida commodo?Suspendisse<br>eget ullamcorper ipsum.Suspendisse<br>diam amet.
<br><br>
<form>
<button name="EXPLORE" type="submit" value="EXPLORE" class="special">EXPLORE</button>
</form>
</div>
</div>
<div class="middle">
<img src="images/bb3.jpg">
</div>
<div class="right">
<div class="r1">
<p class="num">70000</p>
<hr>
<p class="q">Students</p>
</div>
<div class="r2">
<p class="num">600</p>
<hr>
<p class="q">Faculty</p>
</div>
</div>
</div>
<div class="a2">
hfghfhfh
</div>
</div>
<div class="gallery">
<div class="tou">
<dl>
<dt>GALLERY</dt>
<hr align="center">
<dd>
Lorem Ipsum is simply dummy text of the printing and typesetting <br>industry.Lorem Ipsum has been the industry's standard dummy<br> text ever since the 1500s.
</dd>
</dl>
</div>
vbcvbcb
</div>
<div class="footer">
©2016 imooc.com 京ICP备13046642
</div>
</body>
</html>
正在回答 回答被采纳积分+1
- 参与学习 人
- 提交作业 11218 份
- 解答问题 36713 个
从一个不会编程的小白到一个老司机是需要过程的,首先得入门,学习基础知识,然后才能进阶,最后再到精通,本专题是你走进前端世界的不二选择!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星