老师,麻烦帮忙看一下代码是否正确、简洁、美观,显示效果达到作业要求。

来源:4-8 自由编程

ZcKing

2020-12-15 11:47:28

# 具体遇到的问题

# 报错信息的截图

# 相关课程内容截图

# 尝试过的解决思路和结果

# 粘贴全部相关代码,切记添加代码注释(请勿截图)

* {

    margin0;

    padding0;

}


a {

    text-decorationnone;

}


ulol {

    list-stylenone;

}


/* Header区域 */

header {

    height80px;

    background-color#07cbc9;

}


header .header-area {

    width1200px;

    height80px;

    margin0 auto;

}


header .header-area .logo {

    floatleft;

    height48px;

    margin-top16px;

    margin-bottom16px;

}


header .header-area .main-nav {

    floatright;

}


header .header-area .main-nav ul {

    overflowhidden;

}


header .header-area .main-nav ul li {

    floatleft;

    /* margin-right: 20px; */ /* 老师建议多余去掉 */

}


header .header-area .main-nav ul li a {

    displayinline-block;

    padding0 20px;

    height80px;

    line-height80px;

    font-size16px;

    color#ffffff;

}


/* Banner区域 */

.banner {

    positionrelative;

}


.banner .banner-pictures {


}


.banner .banner-pictures img {

    width100%;

    height600px;

    displayblock

}


.banner .banner-mask {

   width100%;

   height600px;

   background-colorrgba(0000.5);

   positionabsolute;

   top0;

   left0;

}


.banner .banner-form {

    width504px;

    height400px;

    positionabsolute;

    left50%;

    margin-left-252px;

    top100px;

}


.banner .banner-form form {


}


.banner .banner-form form input {

    width500px;

    height40px;

    displayblock;

    backgroundnone;

    color#808080;

    border2px solid #808080;

    margin-bottom20px;

}


.banner .banner-form form textarea {

    width500px;

    height110px;

    displayblock;

    backgroundnone;

    color#808080;

    border2px solid #808080;

    margin-bottom20px;

}


.banner .banner-form form p {

    text-aligncenter;

}


.banner .banner-form form p input {

    displayinline-block;

    width200px;

    height40px;

    backgroundnone

    color#808080;

    border2px solid #808080;

}


/* About区域 */

.about {

    width1200px;

    margin0 auto;

    margin-top20px;

}


/* about上半部分 */

.about .about-top-half-part h3 {

    font-size32px;

    text-aligncenter;

}


.about .about-top-half-part .about-top-half-part-division-line {

    width60px;

    height3px;

    background-color#07cbc9;

    margin10px auto;

}


.about .about-top-half-part .about-top-half-part-module-content {

    width445px;

    margin0 auto;

}


.about .about-top-half-part .about-top-half-part-module-content p {

    text-aligncenter;

    colorgray;

    font-size14px;

}


/* 下半部分 */

.about .about-bottom-half-part {

    margin-top30px;

    overflowhidden;

}


/* 小模块1 */

.about .about-bottom-half-part .about-bottom-half-part-module1 {

    floatleft;

    width280px;

    positionrelative;

}


.about .about-bottom-half-part .about-bottom-half-part-module1 h2 {

    width130px;

    margin-bottom20px;

}


.about .about-bottom-half-part .about-bottom-half-part-module1 .content-and-explore {

    /* 子绝父相对 */

    /* 根据作业要求需要对图片进行遮盖且结合课程教学,目前最好的使用方式是绝对路径 */

    positionabsolute;

    border1px solid gray;

    background-colorrgba(2552552550.5);

}


.about .about-bottom-half-part .about-bottom-half-part-module1 .content-and-explore .content {

    width300px;

    padding20px;

    font-size18px;

}


.about .about-bottom-half-part .about-bottom-half-part-module1 .content-and-explore .explore {

    padding0 0 20px 20px;

}


.about .about-bottom-half-part .about-bottom-half-part-module1 .content-and-explore .explore input{

    background-colorblack;

    colorwhite;

    width140px;

    height40px;

    font-size20px;

}


/* 图片模块 */

.about .about-bottom-half-part .about-bottom-half-part-image {

    width650px;

    floatleft;

}


/* 小模块2 */

.about .about-bottom-half-part .about-bottom-half-part-module2 {

    floatright;

}


/* 小模块2 student */

.about .about-bottom-half-part .about-bottom-half-part-module2 .student {

    width260px;

    border1px solid #07cbc9;

    margin-bottom30px;

    padding40px 0;

}


.about .about-bottom-half-part .about-bottom-half-part-module2 .student h4 {

    font-size28px;

    font-weightbold;

    text-aligncenter;

}


.about .about-bottom-half-part .about-bottom-half-part-module2 .student .division-line {

    width60px;

    height3px;

    background-color#07cbc9;

    margin10px auto;

}


.about .about-bottom-half-part .about-bottom-half-part-module2 .student span {

    displayblock;

    text-aligncenter;

    font-size18px;

}


/* 小模块2 faculty */

.about .about-bottom-half-part .about-bottom-half-part-module2 .faculty {

    width260px;

    border1px solid #07cbc9;

    padding40px 0;

}


.about .about-bottom-half-part .about-bottom-half-part-module2 .faculty h4 {

    font-size28px;

    font-weightbold;

    text-aligncenter;

}


.about .about-bottom-half-part .about-bottom-half-part-module2 .faculty .division-line {

    width60px;

    height3px;

    background-color#07cbc9;

    margin10px auto;

}


.about .about-bottom-half-part .about-bottom-half-part-module2 .faculty span {

    displayblock;

    text-aligncenter;

    font-size18px;

}


<!DOCTYPE html>

<html lang="en">

*****************************************************************************************************

<head>

    <meta charset="UTF-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>CarBuilder</title>

    <meta name="Keywords" content="CarBuilder">

    <meta name="Description" content="CarBuilder">

    <link rel="stylesheet" href="css/css.css">

</head>


<body>

    <!-- Header区域 -->

    <header>

        <div class="header-area">

            <!-- logo -->

            <div class="logo">

                <img src="./images/logo.png" alt="logo" />

            </div>


            <!-- 导航区域 -->

            <nav class="main-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图片 -->

        <div class="banner-pictures">

            <img src="./images/banner3.jpg" />

        </div>

        <!-- banner遮罩层 -->

        <div class="banner-mask">banner遮罩层</div>

        <!-- banner表单 -->

        <div class="banner-form">

            <form action="" method="post">

                <input type="text" placeholder="Your Name" />

                <input type="text" placeholder="Your Phone" />

                <input type="email" placeholder="your Email" />

                <textarea rows="5" cols="50" placeholder="Write Your Comment Here"></textarea>

                <p>

                    <input type="button" value="SEND MESSAGE" />

                </p>

            </form>

        </div>

    </section>


    <!-- About区域 -->

    <section class="about">

        <!-- about上半部分 -->

        <div class="about-top-half-part">

            <h3>ABOUT</h3>

            <div class="about-top-half-part-division-line"></div>

            <div class="about-top-half-part-module-content">

                <p>Lorem Ipsum is simply dummytext of the printing and typesetting industry.Lorem Ipsum has been the

                    industry's standarddummy text eversince the 1500s.</p>

            </div>

        </div>

        <!-- about下半部分 -->

        <div class="about-bottom-half-part">

            <!-- 小模块1 -->

            <div class="about-bottom-half-part-module1">

                <h2>A WORD ABOUT US</h2>

                <div class="content-and-explore">

                    <div class="content">

                        <p>Praesent dignissim viverra est,sed bibendum ligula congue non. Sed ac nisl et felisgravida

                            commodo?Suspendisse eget ullamcorper ipsum.Suspendisse diam amet.</p>

                    </div>

                    <div class="explore">

                       <input type="button" value="EXPLORE" />  

                    </div>

                </div>

            </div>


            <!-- 图片模块 -->

            <div class="about-bottom-half-part-image">

                <img src="./images/bb3.jpg" />

            </div>


            <!-- 小模块2 -->

            <div class="about-bottom-half-part-module2">

                <div class="student">

                    <h4>7000</h4>

                    <div class="division-line"></div>

                    <span>Students</span>

                </div>

                <div class="faculty">

                    <h4>600</h4>

                    <div class="division-line"></div>

                    <span>Faculty</span>

                </div>

            </div>

        </div>

    </section>

    <!-- 图片和文字 -->

    <section class="images-and-characters">

        <!-- 图片1 -->

        <div class="picture1">

            <img src="./images/b1.jpg" />

        </div>

        <!-- 文字2 -->

        <div class="character2">

            <h5>Library</h5>

            <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>

        <!-- 图片3 -->

        <div class="picture3">

            <img src="./images/b2.jpg" />

        </div>

        <!-- 文字4 -->

        <div class="character4">

            <h5>Computer Lab</h5>

            <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>

        <!-- 图片5 -->

        <div class="picture5">

            <img src="./images/b3.jpg" />


        </div>

        <!-- 文字6 -->

        <div class="character6">

            <h5>Conference Hall</h5>

            <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>

        <!-- 图片7 -->

        <div class="picture7">

            <img src="./images/b4.jpg" />

        </div>

        <!-- 文字8 -->

        <div class="character8">

            <h5>Play Ground</h5>

            <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>

    </section>

    <!-- Gallery区域 -->

    <div class="gallery">

        <!-- Gallery上半部分(标题和简短描述区域) -->

        <div class="gallery-top-half-part">

            <h5>Gallery</h5>

            <div class="division">分割线</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>

        <!-- Gallery下半部分(详细信息区域) -->

        <div class="gallery-bottom-half-part">

            <dl>

                <dt><img src="./images/03-01.jpg" /></dt>

                <dd>Science Lab</dd>

            </dl>

            <dl>

                <dt><img src="./images/03-02.jpg" /></dt>

                <dd>Indoor Stadium</dd>

            </dl>

            <dl>

                <dt><img src="./images/03-03.jpg" /></dt>

                <dd>Transportation</dd>

            </dl>

            <dl>

                <dt><img src="./images/03-04.jpg" /></dt>

                <dd>Kids Room</dd>

            </dl>

            <dl>

                <dt><img src="./images/03-05.jpg" /></dt>

                <dd>Meditation Classes</dd>

            </dl>

            <dl>

                <dt><img src="./images/03-06.jpg" /></dt>

                <dd>Kids Play Ground</dd>

            </dl>

        </div>

    </div>

    <!-- Footer区域(文字内容) -->

    <div class="footer">

        <p>&copy;2016 imooc.com 京ICP备13046642</p>

    </div>

</body>


</html>


写回答

1回答

好帮手慕张

2020-12-15

同学你好,代码是正确的,有两个优化的建议如下:

1、效果图中EXPLORE按钮没有边框,建议代码中也去掉,效果会美观一些,如下图:

http://img.mukewang.com/climg/5fd86169099c63cc11900371.jpg

2、另外同学粘贴的代码中多了下图圈中的符号,不知道是不是同学不小心碰到的,要删除掉。

http://img.mukewang.com/climg/5fd8619909846bc506400161.jpg

祝学习愉快!


0
hcKing
hp>图圈符号是为了区分css文件和html文件便于老师查阅,谢谢老师解惑

h020-12-15
共1条回复

0 学习 · 15276 问题

查看课程