可以吗 感觉有点乱

来源:5-2 编程练习

whiteDive

2018-12-29 15:15:42

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title></title>
    <style>
        /* 在此处补充代码*/
        * {
            margin: 0;
            padding: 0;
        }

        header, section {
            display: flex;
            justify-content: space-around;
            align-items: center;
        }

        header {
            background-color: black;
            height: 70px;
        }

        .logo, .nav, .login {

        }

        .logo {
            width: 210px;
            height: 70px;
        }

        .logo img {
            height: 100%;
        }

        .nav {
            color: white;
            font-size: 20px;
            display: flex;
            justify-content: space-around;
            width: 500px;
            padding: 0;
        }

        .nav li {
            list-style: none;
            cursor: pointer;
        }

        .login {
            width: 120px;
            display: flex;
            justify-content: space-around;
        }

        .login input {
            color: white;
            font-size: 15px;
            background-color: orange;
            height: 30px;
            width: 40px;
            border-radius: 5px;
            outline: none;
            border: none;
            cursor: pointer;
        }

        section {
            display: flex;
            padding: 20px 30px;
            flex-wrap: wrap;
        }

        .section {
            width: 45%;
            height: 150px;
            border-radius: 10px;
            background-color: #b5d7e4;
            display: flex;
            justify-content: space-around;
            align-items: center;
            margin-bottom: 20px;
        }

        .box {
            height: 150px;
            display: flex;
            flex-direction: column;
            justify-content: space-around;
        }

        .btn {
            background-color: orange;
            width: 100px;
            height: 40px;
            line-height: 40px;
            text-align: center;
            border-radius: 5px;
            color: white;
            cursor: pointer;
        }

        .shopping:hover .btn {
            color: orange;
            background-color: white;
        }
    </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>《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>
</section>
</body>
</html>


写回答

1回答

好帮手慕星星

2018-12-29

同学你好,经测试代码实现效果是不错的。

继续加油!

0

0 学习 · 5012 问题

查看课程