老师这样写可以吗

来源:4-8 自由编程

慕田峪8130438

2021-03-16 12:46:07

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

</head>


<body>

    <!-- header页头区域 -->

    <header>

        <div class="box1">

            <!-- logo区域 -->

            <h1 class="logo">Career Buider</h1>

            <!-- 导航栏区域 -->

            <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横幅区域 -->

    <div class="banner">

        <div><img src="素材/banner3.jpg" alt="sucai"></div>

        <div class="box2">banner遮罩层区域</div>

        <div class="box3">

            <form>

                <input type="text" placeholder="your Name">

                <input type="text" placeholder="your Phone">

                <input type="text" placeholder="your Email">

                <textarea cols="30" rows="10" placeholder="Welte Your Conment Here"></textarea>

                <input type="submit" value="SEND MESSAGE">>

            </form>

        </div>

    </div>

    <!-- about区域 -->

    <div class="box4">

        <div class="about-top">

            <h2>ABOUT</h2>

            <div class="box5"></div>

            <P>borem lpsum is simply dummy text of the printing and typesetting</P>

            <P>industry.Lorem Ipsum has been the industry's standard dummy</P>

            <P>text ever since the 1500s</P>

        </div>

        <div class="about-bottom">

            <div class="title">

                <h2>A WORD</h2>

                <h2>ABOUT US</h2>

            </div>

            <div class="img"><img src="素材/bb3.jpg" alt=""></div>

            <div class="box6">

                <p>Praesent dignissim viverra est,sed</p>

                <p>bibendum ligula congue non Sed</p>

                <p>ac nisl et felis gravida commodo?</p>

                <p>Suspendisse eget Ulโamcorper</p>

                <p>ipsum. Suspendisse diam amet.</p>

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

            </div>

            <div class="box7">

                <p class="p1">7000</p>

                <div></div>

                <p>students</p>

            </div>

            <div class="box8">

                <p class="p1">600</p>

                <div></div>

                <p>Faculty</p>

            </div>

        </div>

    </div>

    <!-- 图片混合区域 -->

    <div>

        <div>图片1</div>

        <div>文字2</div>

        <div>图片3</div>

        <div>文字4</div>

        <div>图片5</div>

        <div>文字6</div>

        <div>图片7</div>

        <div>文字8</div>

    </div>

    <!-- gallery区域 -->

    <div>

        <div>gallery上半区域</div>

        <dl>

            <dt>图片</dt>

            <dd>Science Lab</dd>

        </dl>

        <dl>

            <dt>图片</dt>

            <dd>Indoor Stadium</dd>

        </dl>

        <dl>

            <dt>图片</dt>

            <dd>Transportation</dd>

        </dl>

        <dl>

            <dt>图片</dt>

            <dd>Kids Room</dd>

        </dl>

        <dl>

            <dt>图片</dt>

            <dd>Meditation Classes</dd>

        </dl>

        <dl>

            <dt>图片</dt>

            <dd>Kids Play Ground</dd>

        </dl>


    </div>

    <!-- footre页脚区域 -->

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

</body>


</html>

问题描述:css

* {

    margin0;

    padding0;

}



/* 头部区域 */


a {

    text-decorationnone;

    displayblock;

}


header {

    height80px;

    background-color#07cbc9

}


header .box1 {

    width1200px;

    height80px;

    overflowhidden;

    margin0 auto;

}


.logo {

    floatleft;

    line-height80px;

    color#fff;

}



/* 导航栏 */


nav {

    floatright;

}


nav ul li {

    displayinline-block;

    line-height80px;

    font-size12px;

    list-stylenone;

    margin-left20px;

}


nav ul li a {

    color#fff;

}



/* 横幅区域 */


.banner {

    width100%;

    height600px;

    positionrelative;

}


[alt] {

    width100%;

    height600px;

}


div .box2 {

    width100%;

    height600px;

    positionabsolute;

    top0;

    left0;

    backgroundrgba(0000.5);

}


div .box3 {

    width504px;

    height600px;

    positionabsolute;

    top50%;

    left50%;

    margin-300px 0 0 -252px;

}



/* 表格区域 */


form {

    width504px;

    margin-top100px;

}


[type="text"] {

    displayblock;

    width502px;

    height38px;

    border1px solid #808080;

    backgroundnone;

    outlinenone;

    margin-bottom20px;

    color#808080;

}


form textarea {

    displayblock;

    width502px;

    height110px;

    border1px solid #808080;

    backgroundnone;

    outlinenone;

    margin-bottom25px;

    color#808080;

}


[type="submit"] {

    displayblock;

    width200px;

    height40px;

    border1px solid #808080;

    backgroundnone;

    outlinenone;

    margin0 auto;

    color#808080;

}



/* about区域 */


.box4 {

    width1201px;

    margin0 auto;

}


.box4 .about-top {

    text-aligncenter;

}


.box4 .about-top h2 {

    font-size32px;

    padding-top30px;

    line-height32px;

}


.box4 .about-top .box5 {

    width60px;

    height3px;

    background-color#07cbc9;

    margin20px auto;

}


.box4 .about-top p {

    colorgray;

    font-size14px;

}


.box4 .about-bottom {

    width1201px;

    height464px;

    overflowhidden;

    positionrelative;

}


.box4 .about-bottom .title {

    margin-top30px;

    positionabsolute;

    top0%;

    left0%;

}


.box4 .about-bottom .img img {

    width650px;

    height435px;

    floatleft;

    margin30px 0 0 275px;

}


.box4 .about-bottom .box6 {

    width300x;

    floatleft;

    padding20px;

    font-size18px;

    border1px solid gray;

    backgroundrgba(2552552550.5);

    positionabsolute;

    top50%;

    margin-100px 0 0 0;

}


.box4 .about-bottom .box6 input {

    width140px;

    height40px;

    background-color#000000;

    color#fff;

    outlinenone;

    border1px solid #000000;

    margin-top30px;

    font-size16px;

}


.box4 .about-bottom .box7 {

    width260px;

    height100px;

    floatright;

    margin-top20px;

    padding40px 0;

    backgroundnone;

    border1px solid #07cbc9;

}


.box4 .about-bottom .box7 .p1 {

    font-weight700;

    font-size28px;

    text-aligncenter;

}


.box4 .about-bottom .box7 div {

    width60px;

    height3px;

    background-color#07cbc9;

    margin20px auto;

}


.box4 .about-bottom .box7 p {

    font-size18px;

    text-aligncenter;

}


.box4 .about-bottom .box8 {

    width260px;

    height100px;

    floatright;

    margin-top30px;

    padding40px 0;

    backgroundnone;

    border1px solid #07cbc9;

}


.box4 .about-bottom .box8 .p1 {

    font-weight700;

    font-size28px;

    text-aligncenter;

}


.box4 .about-bottom .box8 div {

    width60px;

    height3px;

    background-color#07cbc9;

    margin20px auto;

}


.box4 .about-bottom .box8 p {

    font-size18px;

    text-aligncenter;

}




写回答

1回答

好帮手慕久久

2021-03-16

同学你好,代码中有如下问题可优化:

1、标题下的文字描述,可以放在一个p标签中,然后使用br标签换行:

http://img.mukewang.com/climg/60504d2609e62cf406260169.jpg

http://img.mukewang.com/climg/60504d450983a0f411950297.jpg

2、标签最好都写成小写,这样更规范:

http://img.mukewang.com/climg/60504d9709e6146008730220.jpg

3、数字区与图片顶部不对齐:

http://img.mukewang.com/climg/60504dc50995416d11210148.jpg

建议将数字区往下调整一下:

http://img.mukewang.com/climg/60504e050960ebff06370302.jpg

4、.box7、.box8两个盒子的样式是一样的,里面的元素样式也是一样的,而同学将相同的样式写了两遍,代码冗余。建议让二者使用同一套样式,从而复用代码。例如:

http://img.mukewang.com/climg/60504ffd095e7e4908360581.jpg

5、图片文件夹,最好使用英文名,这样更规范:

http://img.mukewang.com/climg/6050506d0940a90606310132.jpg

​祝学习愉快!

0

0 学习 · 15276 问题

查看课程