老师好,下层右侧的三角被图片盖住了是为什么
来源:2-17 自由编程
weibo__没趣味_03683219
2021-06-03 11:56:46
css相关代码:
* {
margin: 0;
padding: 0;
}
/* 去掉所有ul,ol小圆点 */
ul,ol {
list-style: none;
}
/* 去掉所有超级链接的下划线 */
a {
text-decoration: none;
}
/* 使用继承性,给body标签设置字体 */
body {
font: normal 14px/25px '微软雅黑';
}
/* header */
header {
width: 100%;
height: 80px;
background-color: #07cbc9;
}
header .head {
width: 1200px;
height: 80px;
margin: 0 auto;
/* 清除浮动 */
overflow: hidden;
}
header .head .logo {
float: left;
padding-top: 16px;
}
header .head .nav {
float: right;
}
header .head .nav ul {
width: 600px;
height: 80px;
}
header .head .nav ul li {
float: left;
padding-left: 20px;
/* 垂直居中-行高等于盒子高 */
line-height: 80px;
}
header .head .nav ul li a {
display: block;
height: 80px;
font-size: 16px;
color: white;
}
/* */
/* */
/* banner */
.banner {
width: 100%;
height: 600px;
position: relative;
}
.banner .banner_image {
width: 100%;
height: 600px;
}
.banner .banner_cover {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 600px;
background-color: rgba(0,0,0,.5);
}
.banner .banner_form {
width: 504px;
position: absolute;
top: 100px;
left: 50%;
margin-left: -252px;
background: none;
text-align: center;
}
.banner .banner_form>input {
width: 498px;
height: 40px;
margin-bottom: 25px;
}
.banner .banner_form textarea {
width: 498px;
height: 110px;
margin-bottom: 25px;
}
.banner .banner_form p .sub {
width: 200px;
height: 40px;
}
.banner .banner_form input,textarea {
border: 3px solid #808080;
background: none;
color: #808080;
}
/* */
/* 内容区域 */
/* 分成左、中、右三大块,设置左右浮动,块内不用设置浮动 */
.content .about {
padding-top: 30px;
width: 1201px;
margin: 0 auto;
overflow: hidden;
}
/* ABOUT上半区域 */
.content .about .about_header {
text-align: center;
width: 500px;
margin: 0 auto;
}
.content .about .about_header h2 {
font-size: 32px;
}
.content .about .about_header .dividing_line {
width: 60px;
height: 3px;background-color: #07cbc9;
margin: 10px auto;
}
.content .about .about_header p {
display: block;
color: gray;
font-size: 14px;
}
/* ABOUT下半区域 */
.content .about .about_details {
position: relative;
width: 1201px;
height: 465px;
padding-top: 30px;
}
.content .about .about_details h3 {
font-size: 28px;
font-weight: bold;
line-height: 45px;
}
.content .about .about_details p {
font-size: 18px;
}
/* 左下 */
.content .about .about_details .about_text {
float: left;
}
.content .about .about_details .about_text h3 {
display: block;
width: 270px;
}
.content .about .about_details .about_text .text {
position: absolute;
top: 50%;
margin-top: -100px;
width: 300px;
padding: 20px;
border: 1px solid gray;
background-color: rgba(255,255,255,0.5);
}
.content .about .about_details .about_text .text a {
display: block;
width: 140px;
height: 40px;
background-color: black;
color: white;
line-height: 40px;
text-align: center;
margin-top: 30px;
}
/* 中间 */
.content .about .about_details .pic {
width: 650px;
height: 435px;
float: left;
}
.content .about .about_details .pic img {
width: 650px;
height: 435px;
}
/* 右边 */
.content .about .about_details .data {
width: 260px;
float: right;
}
.content .about .about_details .data .stu,.faculty {
width: 178px;
border: 1px solid #07cbc9;
text-align: center;
padding: 40px;
}
.content .about .about_details .data .dividing_line {
width: 60px;
height: 3px;
background-color: #07cbc9;
margin: 10px auto;
}
.content .about .about_details .data .stu {
margin-bottom: 30px;
}
/* 图文混排区 */
.content .images_passages {
width: 100%;
position: relative;
}
.content .images_passages .d {
float: left;
width: 25%;
height: 380px;
background-color: #07cbc9;
position: relative;
}
/* 由于img是行内元素,默认存在间隙,可以给图片添加display:block;属性消除间隙 */
.content .images_passages .d h3 {
padding-top: 20px;
padding-left: 20px;
font-size: 24px;
color: white;
}
.content .images_passages .d img {
display: block;
width: 100%;
height: 100%;
}
.content .images_passages .d .d_text {
/* margin-top: 30px; */
/* padding-left: 20px; */
padding: 30px 20px;
font-size: 16px;
color: gray;
}
.content .images_passages .text_right::before {
content: "";
width: 0;
height: 0;
border: 20px solid transparent;
border-right-color: #07cbc9;
position: absolute;
top: 170px;
left: -40px;
}
.content .images_passages .text_left::after {
content: "";
width: 0;
height: 0;
border: 20px solid transparent;
border-left-color: #07cbc9;
position: absolute;
top: 170px;
right: -40px;
}
.content .images_passages .d .d_text p {
margin-bottom: 20px;
}
.content .images_passages .d a {
display: block;
width: 138px;
height: 40px;
background-color: black;
color: white;
line-height: 40px;
text-align: center;
margin: 30px auto;
}
/* */
/* gallery上半 */
.content .gallery {
padding-top: 30px;
width: 1201px;
margin: 0 auto;
overflow: hidden;
}
/* ABOUT上半区域 */
.content .gallery .gallery_header {
text-align: center;
width: 500px;
margin: 0 auto;
}
.content .gallery .gallery_header h2 {
font-size: 32px;
}
.content .gallery .gallery_header .dividing_line {
width: 60px;
height: 3px;background-color: #07cbc9;
margin: 10px auto;
}
.content .gallery .gallery_header p {
display: block;
color: gray;
font-size: 14px;
}
/* gallery下半 */
.content .gallery .gallery_details {
width: 1160px;
height: 613px;
padding: 20px;
margin: 0 auto;
overflow: hidden;
}
.content .gallery .gallery_details dl {
float: left;
width: 360px;
height: 290px;
margin-right: 40px;
margin-bottom: 30px;
}
.content .gallery .gallery_details dl:nth-child(3n) {
margin-right: 0;
}
.content .gallery .gallery_details dl:nth-child(n+4) {
margin-bottom: 0;
}
.content .gallery .gallery_details dl dt img {
display: block;
width: 360px;
height: 240px;
}
.content .gallery .gallery_details dl dd {
display: block;
width: 340px;
height: 50px;
line-height: 50px;
color: white;
background-color: black;
padding-left:20px ;
}
footer {
width: 100%;
height: 80px;
background-color: #07cbc9;
text-align: center;
line-height: 80px;
}
html相关代码:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Career Bulider</title>
<meta name="Description" content=" ">
<meta name="Keywords" content=" ">
<link rel="stylesheet" href="css/css.css">
</head>
<body>
<!-- Header区域 -->
<header>
<div class="head">
<!-- logo -->
<div class="logo">
<img src="images/logo.png" alt="">
</div>
<!-- nav -->
<nav class="nav">
<ul>
<li><a href="">HOME</a></li>
<li><a href="">ABOUT</a></li>
<li><a href="">GALLERY</a></li>
<li><a href="">FACULTY</a></li>
<li><a href="">EVENTS</a></li>
<li><a href="">CONTACT</a></li>
</ul>
</nav>
</div>
</header>
<!-- Banner区域 -->
<section class="banner">
<!-- banner图片 -->
<img class="banner_image" src="images/banner3.jpg" alt="">
<!-- banner遮罩层 -->
<div class="banner_cover">banner遮罩层</div>
<!-- banner表单 -->
<form class="banner_form" action="" method="POST">
<input type="text" placeholder="your Name">
<input type="text" placeholder="your Phone">
<input type="email" placeholder="your Email">
<textarea placeholder="Write Your Comment Here"></textarea>
<p><input class="sub" type="submit" value="SEND MESSAGE"></p>
</form>
</section>
<!-- content区域 -->
<section class="content">
<!-- About区域 -->
<section class="about">
<!-- About区域标题和简短描述 -->
<div class="about_header">
<h2>ABOUT</h2>
<div class="dividing_line"></div>
<div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.</p>
</div>
</div>
<!-- About区域详细描述 -->
<div class="about_details">
<!-- 文字描述 -->
<div class="about_text">
<h3>A WORD<br>ABOUT US</h3>
<div class="text">
<div>
<p>Praesent dignissim viverra est, sed bibendum ligula congue non. Sed ac nisl et felis gravida commodo? Suspendisse eget ullamcorper ipsum. Suspendisse diam amet.</p>
</div>
<div>
<a href="">EXPLORE</a>
</div>
</div>
</div>
<!-- 图片描述 -->
<div class="pic">
<img src="images/bb3.jpg" alt="">
</div>
<!-- 数据 -->
<div class="data">
<div class="stu">
<h3>70000</h3>
<div class="dividing_line"></div>
<p>Sdudents</p>
</div>
<div class="faculty">
<h3>600</h3>
<div class="dividing_line"></div>
<p>Faculty</p>
</div>
</div>
</div>
</section>
<!-- 图文混排区域 -->
<section class="images_passages">
<!-- 图1 -->
<div class="d">
<img src="images/b1.jpg" alt="">
</div>
<!-- 文2 -->
<div class="d db">
<h3>Library</h3>
<div class="d_text text_right">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry
</p>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
</div>
<div>
<a href="">EXPLORE</a>
</div>
</div>
<!-- 图3 -->
<div class="d">
<img src="images/b2.jpg" alt="">
</div>
<!-- 文4 -->
<div class="d db">
<h3>Computer Lab</h3>
<div class="d_text text_right">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry
</p>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
</div>
<div>
<a href="">EXPLORE</a>
</div>
</div>
<!-- 文5 -->
<div class="d da">
<h3>Conference Hall</h3>
<div class="d_text text_left">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry
</p>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
</div>
<div>
<a href="">EXPLORE</a>
</div>
</div>
<!-- 图6 -->
<div class="d">
<img src="images/b3.jpg" alt="">
</div>
<!-- 文7 -->
<div class="d da">
<h3>Play Ground</h3>
<div class="d_text text_left">
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry
</p>
<p>Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
</div>
<div>
<a href="">EXPLORE</a>
</div>
</div>
<!-- 图8 -->
<div class="d">
<img src="images/b4.jpg" alt="">
</div>
</section>
<!-- Gallery区域 -->
<section class="gallery">
<!-- Gallery区域简短描述 -->
<div class="gallery_header">
<h2>GALLERY</h2>
<div class="dividing_line"></div>
<div>
<p>Lorem Ipsum is simply dummy text of the printing and typesetting industry.Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.</p>
</div>
</div>
<!-- Gallery区域详细信息 -->
<div class="gallery_details">
<dl>
<dt>
<img src="images/03-01.jpg" alt="">
</dt>
<dd>Science Lab</dd>
</dl>
<dl>
<dt>
<img src="images/03-02.jpg" alt="">
</dt>
<dd>Indoor Stadium</dd>
</dl>
<dl>
<dt>
<img src="images/03-03.jpg" alt="">
</dt>
<dd>Transportation</dd>
</dl>
<dl>
<dt>
<img src="images/03-04.jpg" alt="">
</dt>
<dd>Kids Room</dd>
</dl>
<dl>
<dt>
<img src="images/03-05.jpg" alt="">
</dt>
<dd>Meditation Classes</dd>
</dl>
<dl>
<dt>
<img src="images/03-06.jpg" alt="">
</dt>
<dd>Kids Play Ground</dd>
</dl>
</div>
</section>
</section>
<!-- Footer区域 -->
<footer>
<p>©2016 imooc.com 京ICP备13046642号</p>
</footer>
</body>
</html>
1回答
同学你好,解答如下:
由于.d_text text_left后面的元素.d(图6)设置了定位(relative):
并且结构上,图6处于三角形的后面:
而三角形与图6都没有设置z-index属性,所以图6的层级比三角形大,会覆盖在三角形上,导致看不到三角形。
(设置定位的元素,都没有设置z-index属性时,结构上处于后面的元素层级大)
建议给三角形设置层级,如下:
祝学习愉快!
相似问题