请老师帮忙检查有无需要注意的问题和需要修改优化的

请老师帮忙检查有无需要注意的问题和需要修改优化的

1
<!DOCTYPE html><br><html lang="en"><br><br><head><br>    <meta charset="UTF-8"><br>    <meta name="viewport" content="width=device-width, initial-scale=1.0"><br>    <title>习题</title><br>    <link rel="stylesheet" href="css/index.css"><br></head><br><br><body><br>    <!-- Header区域 --><br>    <header><br>        <!-- logo --><br>        <img src="images/logo.png" alt=""><br>        <!-- 导航 --><br>        <nav><br>            <ul><br>                <li>HOME</li><br>                <li>ABOUT</li><br>                <li>GALLERY</li><br>                <li>FACULTY</li><br>                <li>EVENTS</li><br>                <li>CONTACT</li><br>            </ul><br>        </nav><br>    </header><br><br>    <!-- Banner区域 --><br>    <div class="banner"><br>        <!-- banner图片 --><br>        <img class="banner-images" src="images/banner3.jpg" alt=""><br>        <!-- banner遮罩层 --><br>        <div class="banner-mask-layer"></div><br>        <!-- banner表单 --><br>        <div class="banner-forms"><br>            <form action=""><br>                <input class="common" type="text" placeholder="your Name"><br>                <input class="common" type="text" placeholder="your Phone"><br>                <input class="common" type="email" name="" id="" placeholder="your Email"><br>                <textarea class="ta common" name="" id="" cols="50" rows="5" placeholder="Write Your Comment Here"></textarea><br/><br>                <input class="submit common" type="submit" value="SEND MASSAGE"><br>            </form><br>        </div><br>    </div><br><br>    <!-- About区域 --><br>    <div class="about"><br>        <!-- 标题和简短描述区域 --><br>        <div class="about-up"><br>            <h2>ABOUT</h2><br>            <p class="boundary"></p><br>            <p class="short-depict">Lorem Ipsum is simply dummy text of the printing and typesetting <br />industry. Lorem Ipsum has been the<br>                industry's standard dummy <br />text ever since the 1500s.</p><br>        </div><br>        <!-- 详细描述区 --><br>        <div class="about-down"><br>            <h3>A WORD <br />ABOUT US</h3><br>            <div class="block1"><br>                <p>Praesent dignissim viverra est, sed bibendum ligula congue non. Sed ac nisl et felis gravida commodo?<br>                    Suspendisse eget ullamcorper ipsum. Suspendisse diam amet.</p><br>                <span>EXPLORE</span><br>            </div><br>            <img src="images/bb3.jpg" alt=""><br>            <div class="about-down-right"><br>                <div><br>                    <p>70000</p><br>                    <p class="boundary"></p><br>                    <p>Students</p><br>                </div><br>                <div><br>                    <p>600</p><br>                    <p class="boundary"></p><br>                    <p>Faculty</p><br>                </div><br>            </div><br>        </div><br>    </div><br><br>    <!-- 图文混排区域 --><br>    <div class="images-and-text"><br>        <div class="image-and-text1"><br>            <img src="images/b1.jpg" alt=""><br>            <h3>Library</h3><br>            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry</p><br>            <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.<br>            </p><br>            <p>EXPLORE</p><br>        </div><br>        <div class="image-and-text2"><br>            <img src="images/b2.jpg" alt=""><br>            <h3>Library</h3><br>            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry</p><br>            <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.<br>            </p><br>            <p>EXPLORE</p><br>        </div><br>        <div class="image-and-text3"><br>            <h3>Library</h3><br>            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry</p><br>            <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.<br>            </p><br>            <p>EXPLORE</p><br>            <img src="images/b3.jpg" alt=""><br>        </div><br>        <div class="image-and-text4"><br>            <h3>Library</h3><br>            <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry</p><br>            <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.<br>            </p><br>            <p>EXPLORE</p><br>            <img src="images/b4.jpg" alt=""><br>        </div><br>    </div><br><br>    <!-- Gallery区域 --><br>    <div class="gallery"><br>        <!-- 标题和简短描述区域 --><br>        <div class="gallery-up"><br>            <h2>GALLERY</h2><br>            <p class="boundary"></p><br>            <p>Lorem Ipsum is simply dummy text of the printing and typesetting <br />industry. Lorem Ipsum has been the<br>                industry's standard dummy <br />text ever since the 1500s.</p><br><br>        </div><br>        <!-- gallery详细信息区 --><br>        <div class="gallery-down"><br>            <dl><br>                <dt><img src="images/03-01.jpg" alt=""></dt><br>                <dd>Science Lab</dd><br>                <dt><img src="images/03-02.jpg" alt=""></dt><br>                <dd>Indoor Stadium</dd><br>                <dt><img src="images/03-03.jpg" alt=""></dt><br>                <dd>Transportation</dd><br>                <dt><img src="images/03-04.jpg" alt=""></dt><br>                <dd>Kids Room</dd><br>                <dt><img src="images/03-05.jpg" alt=""></dt><br>                <dd>Meditation Classes</dd><br>                <dt><img src="images/03-06.jpg" alt=""></dt><br>                <dd>Kids Play Ground</dd><br>            </dl><br>        </div><br>    </div><br><br>    <!-- Footer页脚 --><br>    <div class="footer"><br>        <p></p><br>        &copy;&nbsp;2016&nbsp;imooc.com&nbsp;京ICP备13046642号<br>    </div><br></body><br><br></html><br>


css

1
​*{<br>    margin: 0;<br>    padding: 0;<br>}<br>ul,ol{<br>    list-style: none;<br>}<br>/* 所有的分割线 */<br>.boundary{<br>    width: 60px;<br>    height: 3px;<br>    background: #07cbc9;<br>    margin: 10px auto;<br>}<br>header{<br>    width: 100%;<br>    height: 80px;<br>    background-color: #07cbc9;<br>}<br>header .head{<br>    width: 1060px;<br>    margin: 0 auto;<br>    overflow: hidden;<br>    padding: 16px 0;<br>}<br>header img{<br>    float: left;<br>    margin-top: 16px;<br>    margin-left: 20px;<br>}<br>header nav{<br>    float: right;<br>}<br>header nav ul li{<br>    float: left;<br>    font-size: 16px;<br>    color: #fff;<br>    padding:0 10px;<br>    text-align: center;<br>    line-height: 80px;<br>}<br>.banner{<br>    position: relative;<br>    width: 100%;<br>    height: 600px;<br>    overflow: hidden;<br>}<br>.banner .banner-images{<br>    width: 100%;<br>    height: 600px;<br>}<br>.banner .banner-mask-layer{<br>    position: absolute;<br>    top: 0;<br>    left: 0;<br>    height: 600px;<br>    width: 100%;<br>    background:rgba(0, 0, 0, 0.5);<br>}<br>.banner .banner-forms{<br>    position: absolute;<br>    top: 100px;<br>    left: 50%;<br>    margin-left: -252px;<br>    z-index: 1;<br>    width: 504px;<br><br>}<br>.banner .banner-forms form input{<br>    margin-bottom: 10px;<br><br>}<br>.banner .banner-forms form .common {<br>    height: 40px;<br>    width: 502px;<br>    border: 1px solid #808080;<br>    background:none;<br>}<br>.banner .banner-forms form .ta{<br>    height: 110px;<br>    margin-bottom: 15px;<br>}<br>.banner .banner-forms form .submit{<br>    width: 200px;<br>    margin: 0 152px;<br>    color: #808080;<br>}<br>.about{<br>    width: 100%;<br>    padding-top: 30px;<br>}<br>.about .about-up h2{<br>    font-size: 32px;<br>    text-align: center;<br>}<br><br>.about .about-up .short-depict{<br>    text-align: center;<br>    color: gray;<br>    font-size: 14px;<br>}<br>.about .about-down{<br>    width: 1200px;<br>    height: 464px;<br>    margin: 0 auto;<br>    padding-top: 30px;<br>    overflow: hidden;<br>    position: relative;<br>}<br>.about .about-down h3{<br>    font-size: 28px;<br>    width: 150px;<br>}<br>.about .about-down .block1{<br>    position: absolute;<br>    width: 300px;<br>    padding: 20px;<br>    margin-top: 20px;<br>    font-size: 18px;<br>    border: 1px solid gray;<br>    background: rgba(255, 255, 255, 0.5);<br>}<br><br>.about .about-down .block1 span{<br>    display: inline-block;<br>    width: 140px;<br>    height: 40px;<br>    background: black;<br>    color: white;<br>    text-align: center;<br>    line-height: 40px;<br>    margin-top: 20px;<br>}<br>.about .about-down img{<br>    float: left;<br>    margin-left: 269px;<br>    margin-top: -78px;<br>    width: 650px;<br>    height: 435px;<br>}<br>.about .about-down .about-down-right{<br>    float: right;<br>    margin-top: -78px;<br>}<br>.about .about-down .about-down-right div{<br>    width: 260px;<br>    text-align: center;<br>    border: 1px solid #07cbc9;<br>    margin-bottom: 30px;<br>    padding: 40px 0;<br>}<br>.about .about-down .about-down-right div p:first-child{<br>    font-size: 28px;<br>    font-weight: bold;<br>}<br><br>


正在回答

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

1回答

同学你好 ,代码效果实现是对的。

建议优化:可以给h3标题设置左浮动,让所有内容在一排显示

http://img1.sycdn.imooc.com//climg/5ffa989e096da93c03810153.jpg

调整图片的margin-left属性值,然后,去掉图片和about-down-right的margin-top属性值,让内容顶部对齐显示了。这样就不需要计算向上移动多少距离了

http://img1.sycdn.imooc.com//climg/5ffa990809ac352a06200349.jpg

由于标题设置的左浮动,脱离文档流,影响了遮罩层的位置,可以给遮罩层添加top属性值,调整遮罩层的位置

http://img1.sycdn.imooc.com//climg/5ffa995d091109cb06090299.jpg

祝学习愉快~

  • 扶耳摩兔 提问者 #1
    老师,调整之后这样了,感觉并不美观?http://img1.sycdn.imooc.com//climg/5ffae1a60951fbb819201020.jpg
    2021-01-10 19:14:54
  • 好帮手慕慕子 回复 提问者 扶耳摩兔 #2

    同学你好,有没有调整图片的margin-left属性值呢?如下图所示:

    http://img1.sycdn.imooc.com//climg/5ffbaa3e09f6246e06760359.jpg

    代码实现是很灵活的,同学代码中的实现的方式是可以的,老师给同学推荐的优化方法,主要是为了减少计算图片和右侧内容需要向上移动多少距离,实现内容顶部对齐的效果

    如果还有问题,可以将你修改后的代码粘贴过来,老师帮助同学测试

    祝学习愉快~

    2021-01-11 09:36:20
  • 扶耳摩兔 提问者 回复 好帮手慕慕子 #3
    啊啊,没有设置,可能看漏了,现在好了,谢谢老师?
    2021-01-11 12:19:54
问题已解决,确定采纳
还有疑问,暂不采纳

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

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

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

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

帮助反馈 APP下载

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

公众号

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

在线咨询

领取优惠

免费试听

领取大纲

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