老师帮忙检查一下

来源:3-17 编程练习

ToExpress

2021-04-20 17:41:02

<!DOCTYPE html>

<html>

<head>

    <meta charset="UTF-8">

    <title></title>

    <style>

        /* 在此处补充代码*/

        * {

            margin0;

            padding0;

        }


        header {

            box-sizingborder-box;

            displayflex;

            width100%;

            height100px;

            justify-contentspace-between;

            align-itemscenter;

            padding10px 30px;

            background#000;

        }


        .nav {

            displayflex;

            list-stylenone;

            width40%;

            font-size24px;

            justify-contentspace-between;

            colorrgb(250243243);

        }


        .login {

            displayflex;

            width8%;

            justify-contentspace-between;

        }


        .login input {

            backgroundrgb(23819057);

            border-radius:3px;

            border-colorrgba(0000);

        }

        section{

            displayflex;

            width100%;

            height300px;

            flex-wrapwrap;

            justify-contentspace-around;

            box-sizingborder-box;

            align-items:center;

        }

        .section{

            displayflex;

            backgroundrgb(150218247);

            width:45%;

            box-sizingborder-box;

            height:130px;

            border-radius5px;

            justify-contentspace-around;

            align-itemscenter;

        }

        .box{

            displayflex;

            box-sizingborder-box;

            width:40%;

            height90%;

            flex-wrapwrap;

            align-itemscenter;

          

        }

        .shopping{

            display:flex;

            background:rgb(23819057); 

             width:18%;

             height:25%;

             font-size:20px;

             justify-contentcenter;

             align-itemscenter;

             border-radius5px;

            color#ffffff;

            cursorpointer;

        }

    </style>

</head>


<body>

    <!-- 头部 -->

    <header>

        <div class="logo">

            <img src="http://climg.mukewang.com/59197ab000014f1503000100.jpg" alt="">

        </div>

        <ul class="nav">

            <li>课程</li>

            <li>路径</li>

            <li>猿问</li>

            <li>手记</li>

        </ul>

        <div class="login">

            <input type="button" value="登录">

            <input type="button" value="注册">

        </div>

    </header>

    <!-- 主体内容 -->

    <section>

        <div class="section">

            <div class="box">

                <p>《前端小白入门手册》</p>

                <div>适用人群:没有任何前端基础的小白</div>

                <div>费用:¥499</div>

            </div>

            <div class="shopping">

                <div class="btn">加入购物车</div>

            </div>

        </div>

        <div class="section">

            <div class="box">

                <p>《HTML5月CSS3实现动态网页》</p>

                <div>适用人群:有html和css基础的童鞋</div>

                <div>费用:¥599</div>

            </div>

            <div class="shopping">

                <div class="btn">加入购物车</div>

            </div>

        </div>

        <div class="section">

            <div class="box">

                <p>《前端小白入门手册》</p>

                <div>适用人群:没有任何前端基础的小白</div>

                <div>费用:¥499</div>

            </div>

            <div class="shopping">

                <div class="btn">加入购物车</div>

            </div>

        </div>

        <div class="section">

            <div class="box">

                <p>《HTML5月CSS3实现动态网页》</p>

                <div>适用人群:有html和css基础的童鞋</div>

                <div>费用:¥599</div>

            </div>

            <div class="shopping">

                <div class="btn">加入购物车</div>

            </div>

        </div>

    </section>

</body>


</html>


写回答

1回答

好帮手慕慕子

2021-04-20

同学你好,代码中存在的问题解答如下:

1、按钮文字颜色与效果图不符

http://img.mukewang.com/climg/607ea3b00950c71b01820081.jpg

建议调整字体颜色为白色,并设置适当的padding属性值,效果实现会更美观。

http://img.mukewang.com/climg/607ea3f609fd3d8b05590214.jpg

2、卡片的文字布局不对,如下图所示:

http://img.mukewang.com/climg/607ea40f092ae21519000405.jpg

原因:父级box盒子能够容纳文字内容在一行显示,所以没有换行显示。

建议:可以给box下的div设置宽度为百分百,让其独占一行显示。

http://img.mukewang.com/climg/607ea477098d957d02360088.jpg

3、按钮中的文字垂直居中存在误差,如下图所示:

http://img.mukewang.com/climg/607ea4b0098e783e02310083.jpg

建议:去掉按钮的高度,让其由文字撑开高度,然后通过上下padding调整间距,实现垂直居中效果。

http://img.mukewang.com/climg/607ea52b09dd764c06070357.jpg

4、样式相同的代码,可以使用组合选择器,书写在一起。示例:

http://img.mukewang.com/climg/607ea5bd0948de7607020725.jpg

祝学习愉快~

0

0 学习 · 15276 问题

查看课程