老师,我的Gallery不能往下移了

老师,我的Gallery不能往下移了

<!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>Document</title>
<link rel="stylesheet" href="css/CSS.CSS">
</head>

<body>相关代码:
<!-- Header区域 -->
<div class="header">
<div class="box1">
<div class="logo">
<img src="images/logo.png" alt="">
</div>
<div class="nav">
<ul>
<li>HOME</li>
<li>ABOUT</li>
<li>GALLERY</li>
<li>FACULTY</li>
<li>EVENTS</li>
<li>CONTACT</li>
</ul>
</div>
</div>
</div>

<!-- Banner区域 -->
<div class="banner">
<!-- Banner图片 -->
<div class="banner-img">
<img src="images/banner3.jpg" alt="">
</div>
<div class="banner-mask"></div>
<div class="banner-form">
<form action="">
<p>
<input class="name" type="text" placeholder="your Name">
</p>
<p>
<input class="phone" type="text" placeholder="your Phone">
</p>
<p>
<input class="email" type="email" placeholder="your Email">
</p>
<p>
<textarea class="comment" name="" id="" cols="30" rows="5"
placeholder="Write Your Comment Here"></textarea>
</p>
<p>
<input class="submit" type="submit" value="SEND MESSAGE">
</p>
</form>
</div>
</div>

<!-- About区域 -->
<div class="about">
<div class="box2">
<!-- 上半部 -->
<div class="shangbanbu">
<h2 class="title">ABOUT</h2>
<!-- 分割线 -->
<div class="line1"></div>
<p class="para1">Lorem Ipsum is simply dummy text of the printing and typesetting <br>industry. Lorem Ipsum has been the
industry's standard
dummy text<br> ever since the 1500s.</p>
</div>
<!-- 下半部 -->
<div class="xiabanbu">
<h2 class="title">A WORD <br>ABOUT US</h2>

<div class="left">
<p class="left1">
Praesent dignissim viverra est, sed<br> bibendum ligula congue non. Sed<br> ac nisl et felis gravida
commodo?<br>
Suspendisse eget
ullamcorper <br>ipsum. Suspendisse diam amet.
</p>
<p class="left2">EXPLORE</p>
</div>

<img class="photo1" src="images/bb3.jpg" alt="">

<div class="right">
<div class="right1">
<span>70000</span>
<p></p>
<span class="stu">Students</span>
</div>

<div class="right2">
<span>600</span>
<p></p>
<span class="fac">Faculty</span>
</div>
</div>
</div>
</div>
</div>

<!-- 图文混排区域 -->
<div class="images-text">
<div class="img">
<p><img src="images/b1.jpg" alt=""></p>
</div>
<div class="text">
<h3>Library</h3>
<p class="part1">Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>
<p class="part2">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>
<a href="">EXPLORE</a>
</div>

<div class="img">
<p><img src="images/b2.jpg"></p>
</div>
<div class="text">
<h3>Library</h3>
<p class="part1">Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>
<p class="part2">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>
<a href="">EXPLORE</a>

</div>
<div class="text">
<h3>Library</h3>
<p class="part1">Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>
<p class="part2">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>
<a href="">EXPLORE</a>
</div>
<div class="img">
<img src="images/b3.jpg">
</div>
<div class="text">
<h3>Library</h3>
<p class="part1">Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>
<p class="part2">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>
<a href="">EXPLORE</a>
</div>
<div class="img">
<img src="images/b4.jpg">
</div>
</div>

<!-- Gallery区域 -->
<div class="gallery">
<div class="shang">
<div class="title">
<h2>GALLERY</h2>
</div>
<p class="line"></p>
<p class="text">Lorem Ipsum is simply dummy text of the printing and typesetting<br> industry.Lorem Ipsum has been the
industry's standard dummy text<br> ever since the 1500s</p>
</div>
<div class="xia">
<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 class="spec"><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 class="spec"><img src="images/03-06.jpg" alt=""></dt>
<dd>Kids Play Ground</dd>
</dl>
</div>
</div>

<!-- Footer区域 -->
<div class="footer">
<p>&copy; 2016 imooc.com 京ICP备13046642号</p>
</div>
</body>

</html>

相关代码:

/* GALLERY区域 */
.gallery .shang {
margin-top: 30px;
}
.gallery .title h2 {
font-size: 32px;
text-align: center;
}

.gallery .shang p.line {
width: 60px;
height: 3px;
margin: 10px auto;
background: #07cbc9;
}

.gallery .shang p.text {
font-size: 14px;
color: gray;
text-align: center;
}

.gallery .xia {
width: 1200px;
height: 653px;
margin: 0 auto;
}

.gallery .xia dl {
float: left;
}
.gallery .xia dl dt {
display: block;
width: 360px;
height: 240px;
margin-right: 40px;

}

.gallery .xia dl dt.spec {
margin-right: 20px;
}

.gallery .xia dl dd {
width: 340px;
height: 50px;
background-color: black;
color: white;
margin-bottom: 30px;
padding-left: 20px;
line-height: 50px;
}

.footer {
width: 100%;
height: 80px;
background-color: #07cbc9;
}

.footer p {
text-align: center;
line-height: 80px;
}

相关截图:

http://img1.sycdn.imooc.com//climg/60877bb8099eece211680613.jpg

正在回答

登陆购买课程后可参与讨论,去登陆

1回答

同学你好,只粘贴了部分css样式,无法还原效果,老师这边gallery是可以下移的。建议将所有的css全部粘贴上来,便于帮助解决,也可以先检查下是不是上面元素设置固定高度比较小导致的。

另外gallery这部分图文混排没有居中

http://img1.sycdn.imooc.com//climg/608780a309279de615180308.jpg

右侧的间隙是因为设置右侧间距导致的,而左侧没有。建议修改为左右两侧间距,添加在dl上,如下:

http://img1.sycdn.imooc.com//climg/608781240919d8e003660302.jpg

祝学习愉快!

  • 一心励志当码农 提问者 #1
    ​* {
    padding: 0;
    margin: 0;
    }

    .header {
    width: 100%;
    height: 80px;
    background-color: #07cbc9;
    }

    .header .nav ul {
    list-style: none;
    }

    .header .box1 {
    width: 1200px;
    margin: 0 auto;
    }

    .header .box1 .logo {
    float: left;
    margin-top: 16px;
    margin-bottom: 16px;
    }

    .header .box1 .logo img {
    display: block;
    }

    .header .box1 .nav {
    float: right;
    }

    .header .box1 .nav ul li {
    float: left;
    text-align: center;
    line-height: 80px;
    font-size: 16px;
    margin-right: 20px;
    color: white;
    }

    /* Banner区域 */
    .banner {
    position: relative;
    height: 600px;
    }

    .banner .banner-img img {
    display: block;
    width: 100%;
    height: 600px;
    }

    /* 遮罩层设置绝对定位 */
    .banner .banner-mask {
    position: absolute;
    background:rgba(0, 0, 0, .5);
    width: 100%;
    height: 600px;
    top:0px;
    color:white;
    }

    .banner .banner-form {
    position: absolute;
    width: 508px;
    height: 500px;
    left: 50%;
    top:50%;
    margin-left: -252px;
    margin-top: -200px;
    text-align: center;
    }

    .banner .banner-form input[type="text"] {
    display: block;
    width: 504px;
    height: 40px;
    margin-bottom: 20px;
    color: #808080;
    background: none;
    border: 2px solid #808080;
    }

    .banner .banner-form input[type="email"] {
    display: block;
    width: 504px;
    height: 40px;
    margin-bottom: 20px;
    color: #808080;
    background: none;
    border: 2px solid #808080;
    }

    .banner .banner-form textarea {
    display: block;
    width: 504px;
    height: 110px;
    background: none;
    margin-bottom: 30px;
    position: relative;
    border: 2px solid #808080;

    }
    .banner .banner-form input[type="submit"] {
    display: block;
    width: 200px;
    height: 40px;
    background: none;
    color: #808080;
    position: relative;
    left:50%;
    margin-left: -100px;
    border: 2px solid #808080;
    }

    /* ABOUT区域 */
    .about {
    width: 1200px;
    margin: 0 auto;
    }

    .about .box2 .shangbanbu h2.title {
    font-size: 32px;
    text-align: center;
    margin-top: 30px;
    }

    /* 分割线1 */
    .about .box2 .shangbanbu .line1 {
    width: 60px;
    height: 3px;
    margin: 10px auto;
    background: #07cbc9;
    }

    .about .box2 .shangbanbu .para1 {
    text-align: center;
    color: gray;
    font-size: 14px;
    }
    .about .box2 .xiabanbu {
    width: 1201px;
    height: 464px;
    position: relative;
    }

    .about .box2 .xiabanbu img.photo1 {
    float: left;
    position: absolute;
    top:30px;
    left:270px;
    }

    .about .box2 .xiabanbu h2.title {
    position: absolute;
    top:40px;
    }

    .about .box2 .xiabanbu .left {
    position: relative;
    top:150px;
    width: 342px;
    }

    .about .box2 .xiabanbu .left p.left1 {
    position: absolute;
    width: 300px;
    padding: 20px;
    font-size: 18px;
    border: 1px solid gray;
    background-color: rgba(255, 255, 255, .5);

    }

    .about .box2 .xiabanbu .left p.left2 {
    position: absolute;
    width: 140px;
    height: 40px;
    background-color: black;
    color: white;
    text-align: center;
    line-height: 40px;
    top: 161px;
    }
    .about .box2 .xiabanbu .right {
    float: right;
    padding: 70px;
    }
    .about .box2 .xiabanbu .right .right1 {
    position: relative;
    margin-bottom: 70px;
    }
    .about .box2 .xiabanbu .right .right1 span{
    font-size: 28px;
    font-weight: bold;
    }
    /* 分割线 */
    .about .box2 .xiabanbu .right .right1 p {
    width: 60px;
    height: 3px;
    margin: 10px auto;
    background: #07cbc9;
    }

    .about .box2 .xiabanbu .right .right1 span.stu {
    text-align: center;
    font-size: 16px;
    font-weight: normal;
    position: absolute;
    left:5px;
    }

    .about .box2 .xiabanbu .right .right2 span {
    font-size: 28px;
    font-weight: bold;
    }

    .about .box2 .xiabanbu .right .right2 p {
    width: 60px;
    height: 4px;
    margin: 10px auto;
    background: #07cbc9;
    }

    .about .box2 .xiabanbu .right .right2 span.fac {
    text-align: center;
    font-size: 16px;
    font-weight: normal;
    left:5px;
    }

    /* 图文混排区域 */
    .images-text {
    width: 100%;
    }

    .images-text .img img {
    display: block;
    float: left;
    width: 25%;
    height: 380px;
    }

    .images-text .text {
    float: left;
    width: 25%;
    height: 380px;
    background: #07cbc9;
    }

    .images-text .text h3 {
    margin-top: 20px;
    margin-left: 20px;
    margin-bottom: 30px;
    font-size: 24px;
    color: white;
    }

    .images-text .text p.part1 {
    font-size: 16px;
    margin-left: 20px;
    margin-bottom: 20px;
    color: white;
    }

    .images-text .text p.part2 {
    font-size: 14px;
    margin-left: 20px;
    margin-bottom: 30px;
    color: gray;
    }

    .images-text .text a {
    display: block;
    text-decoration: none;
    width: 138px;
    height: 40px;
    background: black;
    color: white;
    text-align: center;
    line-height: 40px;
    margin: 0 auto;
    }

    /* GALLERY区域 */
    .gallery .shang {
    margin-top: 30px;
    }
    .gallery .title h2 {
    font-size: 32px;
    text-align: center;
    }

    .gallery .shang p.line {
    width: 60px;
    height: 3px;
    margin: 10px auto;
    background: #07cbc9;
    }

    .gallery .shang p.text {
    font-size: 14px;
    color: gray;
    text-align: center;
    }

    .gallery .xia {
    width: 1200px;
    height: 653px;
    margin: 0 auto;
    }

    .gallery .xia dl {
    float: left;
    width: 360px;
    margin: 0 20px;
    }
    .gallery .xia dl dt {
    display: block;
    width: 360px;
    height: 240px;
    }

    .gallery .xia dl dt.spec {
    margin-right: 20px;
    }

    .gallery .xia dl dd {
    width: 340px;
    height: 50px;
    background-color: black;
    color: white;
    margin-bottom: 30px;
    padding-left: 20px;
    line-height: 50px;
    }

    .footer {
    width: 100%;
    height: 80px;
    background-color: #07cbc9;
    }

    .footer p {
    text-align: center;
    line-height: 80px;
    }


    老师,麻烦您看一下我的问题,然后还有about区域,感觉也有很多问题

    2021-04-27 11:38:59
  • 一心励志当码农 提问者 #2

    老师问题我自己解决了

    2021-04-27 14:38:31
问题已解决,确定采纳
还有疑问,暂不采纳

恭喜解决一个难题,获得1积分~

来为老师/同学的回答评分吧

0 星
请稍等 ...
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号

在线咨询

领取优惠

免费试听

领取大纲

扫描二维码,添加
你的专属老师