HTML&&CSS练习

1) 效果如下

2) 代码如下

2.1) HTML

html 复制代码
<!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>studyWell</title>
    <link rel="stylesheet" href="./base.css">
    <link rel="stylesheet" href="./index.css">
</head>
<body>
    <!-- 头部区域 -->
    <div class="header">
        <div class="wrapper">
            <div class="logo">
                <h1><a href="#">学成在线</a></h1>
            </div>  
            <div class="nav">
                <ul>
                    <li class="active"><a href="#">HEADER</a></li>
                    <li><a href="#">COURSE</a></li>
                    <li><a href="#">PLAN</a></li>
                </ul>
            </div>
            <div class="search">
                <input type="text" placeholder="Enter Words">
                <a href="#">
                    <svg class="icon" style="width: 1em;height: 1em;vertical-align: middle;fill: currentColor;overflow: hidden;" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="835">
                        <path d="M472.615385 905.846154a433.230769 433.230769 0 1 0 0-866.461539 433.230769 433.230769 0 0 0 0 866.461539z m0-78.769231a354.461538 354.461538 0 1 1 0-708.923077 354.461538 354.461538 0 0 1 0 708.923077z" fill="#000000" p-id="836"></path>
                        <path d="M715.697231 755.081846a39.384615 39.384615 0 0 1 55.689846 0l167.069538 167.069539a39.384615 39.384615 0 1 1-55.689846 55.689846l-167.069538-167.069539a39.384615 39.384615 0 0 1 0-55.689846z m55.689846 55.689846a39.384615 39.384615 0 0 0 0-55.689846l167.069538 167.069539a39.384615 39.384615 0 1 0-55.689846 55.689846l-167.069538-167.069539a39.384615 39.384615 0 0 0 55.689846 0z" fill="#000000" p-id="837"></path>
                    </svg>
                </a>
            </div>    
            <div class="user">
                <a href="#">
                    <img src="https://q5.itc.cn/q_70/images03/20240405/437b3358d28f4938b399298a1f63b651.jpeg" alt="">
                    <span>wave_sky</span>
                </a>
            </div>            
        </div>
    </div>
    <div class="banner">
        <div class="wrapper">
            <div class="left">
                <ul>
                    <li><a href="#">front_end</a></li>
                    <li><a href="#">front_end</a></li>
                    <li><a href="#">front_end</a></li>
                    <li><a href="#">front_end</a></li>
                    <li><a href="#">front_end</a></li>
                    <li><a href="#">front_end</a></li>
                    <li><a href="#">front_end</a></li>
                    <li><a href="#">front_end</a></li>
                    <li><a href="#">front_end</a></li>
                </ul>
            </div>
            <div class="right">
                <h3>Curriculum</h3>
                <div class="content">
                    <dl>
                        <dt>Data Visualization</dt>
                        <dd><span>Learning</span>-<strong>Using Steps</strong></dd>
                    </dl>
                    <dl>
                        <dt>Data Visualization</dt>
                        <dd><span>Learning</span>-<strong>Using Steps</strong></dd>
                    </dl>
                    <dl>
                        <dt>Data Visualization</dt>
                        <dd><span>Learning</span>-<strong>Using Steps</strong></dd>
                    </dl>
                    <a href="#">AllCourses</a>
                </div>
            </div>
        </div>
    </div>
    <div class="recommend wrapper">
        <h3>RECOMMEND</h3>
        <ul>
            <li><a href="#">HTML</a></li>
            <li><a href="#">HTML</a></li>
            <li><a href="#">HTML</a></li>
            <li><a href="#">HTML</a></li>
            <li><a href="#">HTML</a></li>
            <li><a href="#">HTML</a></li>
            <li><a href="#">HTML</a></li>
            <li><a href="#">HTML</a></li>
            <li><a href="#">HTML</a></li>
        </ul>
        <a href="#" class="modify">MODIFY</a>
    </div>
    <!-- 精品推荐课程 -->
    <div class="course wrapper">
        <div class="hd">
            <h3>RECMOOEND</h3>
            <a href="#" class="more">VIEW_ALL</a>
        </div>
        <div class="bd">
            <ul>
                <li>
                    <a href="#">
                        <div class="pic">
                            <img src="https://img0.baidu.com/it/u=2827135641,1933815429&fm=253&fmt=auto&app=120&f=JPEG" alt="">
                        </div>
                        <div class="text">
                            <h4>Fighting</h4>
                            <p><span>Senior</span> . <i>1125</i>人在学习</p>
                        </div>
                    </a>
                </li>
                <li>
                    <a href="#">
                        <div class="pic">
                            <img src="https://img1.baidu.com/it/u=2696472111,1441718876&fm=253&fmt=auto&app=120&f=JPEG?w=508&h=500" alt="">
                        </div>
                        <div class="text">
                            <h4>Fighting</h4>
                            <p><span>Senior</span> . <i>1125</i>人在学习</p>
                        </div>
                    </a>
                </li>
                <li>
                    <a href="#">
                        <div class="pic">
                            <img src="https://img1.baidu.com/it/u=1877419501,1823077687&fm=253&fmt=auto?w=500&h=500" alt="">
                        </div>
                        <div class="text">
                            <h4>Fighting</h4>
                            <p><span>Senior</span> . <i>1125</i>人在学习</p>
                        </div>
                    </a>
                </li>
                <li>
                    <a href="#">
                        <div class="pic">
                            <img src="https://img2.baidu.com/it/u=1933694560,1851305891&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500" alt="">
                        </div>
                        <div class="text">
                            <h4>Fighting</h4>
                            <p><span>Senior</span> . <i>1125</i>人在学习</p>
                        </div>
                    </a>
                </li>
                <li>
                    <a href="#">
                        <div class="pic">
                            <img src="https://img2.baidu.com/it/u=1761921801,1220023983&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500" alt="">
                        </div>
                        <div class="text">
                            <h4>Fighting</h4>
                            <p><span>Senior</span> . <i>1125</i>人在学习</p>
                        </div>
                    </a>
                </li>
                <li>
                    <a href="#">
                        <div class="pic">
                            <img src="https://img1.baidu.com/it/u=2086169455,2318935765&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=1111" alt="">
                        </div>
                        <div class="text">
                            <h4>Fighting</h4>
                            <p><span>Senior</span> . <i>1125</i>人在学习</p>
                        </div>
                    </a>
                </li>
                <li>
                    <a href="#">
                        <div class="pic">
                            <img src="https://img2.baidu.com/it/u=2288673665,3415374068&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500" alt="">
                        </div>
                        <div class="text">
                            <h4>Fighting</h4>
                            <p><span>Senior</span> . <i>1125</i>人在学习</p>
                        </div>
                    </a>
                </li>
                <li>
                    <a href="#">
                        <div class="pic">
                            <img src="https://img0.baidu.com/it/u=1994241505,3792758445&fm=253&fmt=auto&app=120&f=JPEG?w=889&h=500" alt="">
                        </div>
                        <div class="text">
                            <h4>Fighting</h4>
                            <p><span>Senior</span> . <i>1125</i>人在学习</p>
                        </div>
                    </a>
                </li>
                <li>
                    <a href="#">
                        <div class="pic">
                            <img src="https://img1.baidu.com/it/u=1845740325,2917001370&fm=253&fmt=auto&app=120&f=JPEG?w=501&h=500" alt="">
                        </div>
                        <div class="text">
                            <h4>Fighting</h4>
                            <p><span>Senior</span> . <i>1125</i>人在学习</p>
                        </div>
                    </a>
                </li>
                <li>
                    <a href="#">
                        <div class="pic">
                            <img src="https://img0.baidu.com/it/u=1534238486,4029638650&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500" alt="">
                        </div>
                        <div class="text">
                            <h4>Fighting</h4>
                            <p><span>Senior</span> . <i>1125</i>人在学习</p>
                        </div>
                    </a>
                </li>
            </ul>
        </div>
    </div>
    <div class="wrapper">
        <div class="hd">
            <h3>FRONT_END</h3>
            <ul>
                <li><a href="#" class="active">Hot</a></li>
                <li><a href="#">Primary</a></li>
                <li><a href="#">Middle</a></li>
                <li><a href="#">Senior</a></li>
            </ul>
            <a href="#" class="more">VIEW_ALL</a>
        </div>
        <div class="bd">
            <div class="left">
                <img src="https://img1.baidu.com/it/u=2437811644,3824884357&fm=253&fmt=auto&app=120&f=JPEG?w=800&h=1422" alt="">
            </div>
            <div class="right">
                <div class="top">
                    <img src="https://img1.baidu.com/it/u=1184803841,126795988&fm=253&fmt=auto&app=138&f=JPEG?w=658&h=206" alt="">
                </div>
                <div class="bottom">
                    <ul>
                        <li>
                            <a href="#">
                                <div class="pic">
                                    <img src="https://img0.baidu.com/it/u=1534238486,4029638650&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500" alt="">
                                </div>
                                <div class="text">
                                    <h4>Fighting</h4>
                                    <p><span>Senior</span> . <i>1125</i>人在学习</p>
                                </div>
                            </a>
                        </li>
                        <li>
                            <a href="#">
                                <div class="pic">
                                    <img src="https://img1.baidu.com/it/u=292806425,283345048&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500" alt="">
                                </div>
                                <div class="text">
                                    <h4>Fighting</h4>
                                    <p><span>Senior</span> . <i>1125</i>人在学习</p>
                                </div>
                            </a>
                        </li>
                        <li>
                            <a href="#">
                                <div class="pic">
                                    <img src="https://img0.baidu.com/it/u=1323729093,935260311&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500" alt="">
                                </div>
                                <div class="text">
                                    <h4>Fighting</h4>
                                    <p><span>Senior</span> . <i>1125</i>人在学习</p>
                                </div>
                            </a>
                        </li>
                        <li>
                            <a href="#">
                                <div class="pic">
                                    <img src="https://img0.baidu.com/it/u=1865326018,3817185204&fm=253&fmt=auto&app=120&f=JPEG?w=500&h=500" alt="">
                                </div>
                                <div class="text">
                                    <h4>Fighting</h4>
                                    <p><span>Senior</span> . <i>1125</i>人在学习</p>
                                </div>
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div class="footer">
        <div class="wrapper">
            <div class="left">
                <div class="logo">
                    <a href="#"></a>
                </div>
                <p>乾卦(乾为天)乾上乾下《乾》:元亨利贞。初九:潜龙,勿用。九二:见龙在田,利见大人。九三:君子终日乾乾,夕惕若厉,无咎。</p>
                <a href="#" class="download">DOWNLOAD</a>
            </div>
            <div class="right">
                <dl>
                    <dt>Parteners</dt>
                    <dd>Institutions</dd>
                    <dd>Teachers</dd>
                </dl>
                <dl>
                    <dt>Parteners</dt>
                    <dd>Institutions</dd>
                    <dd>Teachers</dd>
                </dl>
                <dl>
                    <dt>Parteners</dt>
                    <dd>Institutions</dd>
                    <dd>Teachers</dd>
                </dl>
            </div>
        </div>
    </div>
</body>
</html>

2.2) CSS1

css 复制代码
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

li {
    list-style: none;
}

body {
    font: 14px/1.5 "Microsoft Yahei", "Hiragino Sans GB", "Heiti SC", "WenQuanYi Micro Hei", sans-serif;
    color: #333;
}

a {
    color: #333;
    text-decoration: none;
}

2.2) CSS2

css 复制代码
.wrapper {
    margin: 0 auto;
    width: 1200px;
}
body {
    background-color: #f3f5f7;
}

/* 头部区域 */
.header {
    height: 100px;
    background-color: #fff;
}
.header .wrapper {
    padding-top: 29px;
    display: flex;
}

/* logo区域 */
.logo a {
    display: block;
    width: 195px;
    height: 41px;
    background-color: #4D7BAD;
    background-image: url("https://img1.baidu.com/it/u=2252996821,1843196218&fm=253&fmt=auto&app=120&f=JPEG?w=549&h=430");
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    font-size: 0;
}

/* 导航 */
.nav {
    margin-left: 102px;
}
.nav ul {
    display: flex;
}

.nav li {
    margin-right: 24px;
}
.nav li a {
    display: block;
    padding: 6px 8px;
    line-height: 27px;
    font-size: 19px;
}

.nav li.active,
.nav li a:hover {
    border-bottom: 2px solid #00a4ff;
}

/* 搜索 */
.search {
    display: flex;
    margin-left: 64px;
    padding-left: 19px;
    padding-right: 12px;
    width: 412px;
    height: 40px;
    background-color: #f3f5f7;
    border-radius: 20px;
}
.search input {
    flex: 1;
    border: 0;
    background-color: transparent;
    outline: none;
}
.search a {
    align-content: center;
}
.user a {
    display: flex;
}
.user a img{
    width: 30px;
    height: 30px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 7px;
}
.user {
    margin-left: 32px;
    margin-top: 4px;
}
.user a span {
    line-height: 30px;
    font-size: 16px;
    color: #666;
}
.banner {
    height: 420px;
    background-color: #0092cb;
}
.banner .wrapper {
    display: flex;
    justify-content: space-between;
    height: 420px;
    background-image: url("https://preview.qiantucdn.com/58pic/62/04/81/39q58PICK58PICB4M3GN2vKS3_origin_PIC2018.png%21w1024_new_small_1");
    background-size: cover;
}
.banner .left {
    padding: 3px 20px;
    width: 191px;
    height: 420px;
    background-color: rgba(0,0,0,0.42);
}
.banner .left a {
    background: url("https://pic.616pic.com/ys_img/01/12/75/QiNqkIMrfj.jpg") no-repeat right center;
    background-size: 30px 30px;
    display: block;
    line-height: 46px;
    font-size: 16px;
    color: #fff;
}
.banner .left a:hover {
    color: #0092CB;
    background: url("https://picx.zhimg.com/v2-e4f59a8cd4edca9f100067e4bc67a639_r.jpg") no-repeat right center;
    background-size: 30px 30px;
}
.banner .right {
    width: 218px;
    height: 305px;
    background-color: #209dd5;
    border-radius: 10px;
    align-self: center;
    margin-right: 5%;
}

.banner .right h3 {
    margin-left: 14px;
    height: 48px;
    line-height: 48px;
    font-size: 15px;
    color: #fff;
    font-weight: 400;
}
.banner .right .content {
    padding: 14px;
    height: 257px;
    background-color: #fff;
    border-radius: 10px;
}
.banner .right dl {
    margin-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
}
.banner .right dt {
    margin-bottom: 8px;
    font-size: 14px;
    line-height: 20px;
    font-weight: 700;
}
.banner .right dd {
    margin-bottom: 8px;
    font-size: 12px;
    line-height: 16px;
}
.banner .right dd span {
    color: #00a4ff;
}
.banner .right dd strong {
    color: #7d7d7d;
    font-weight: 400;
}
.banner .right a {
    display: block;
    height: 32px;
    background-color: #00a4ff;
    border-radius: 15px;
    text-align: center;
    line-height: 32px;
    font-size: 14px;
    color: #fff;
}
.recommend {
    display: flex;
    margin-top: 11px; 
    height: 60px;
    padding: 0 20px;
    line-height: 60px;
    background-color: #fff;
    box-shadow: 0px 1px 2px 0px rgba(211,211,211,0.5);
} 
.recommend h3 {
    font-size: 18px;
    color: #00a4ff;
    font-weight: 400;
}
.recommend ul {
    flex: 1;
    display: flex;
}
.recommend ul li a {
    padding: 0 24px;
    border-right: 1px solid #e0e0e0;
    font-size: 18px;
}
.recommend ul li:last-child a {
    border-right: 0;
}
.recommend .modify {
    font-size: 16px;
    color: #00a4ff
}
.course {
    margin-top: 15px;
}
.hd {
    display: flex;  
    justify-content: space-between;
    height: 60px;
    line-height: 60px;
}
.hd h3 {
    font-size: 21px;
    font-weight: 400;
}
.hd .more {
    font-size: 14px;
    color: #999;
    padding-right: 20px;
}
.bd ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
}
.bd li {
    margin-bottom: 14px;
    width: 228px;
    height: 271px;
    background-color: pink;
}
.bd li .pic {
    height: 156px;
}
.bd li .text {
    padding: 20px;
    height: 115px;
    background-color: #fff;
}
.bd li .pic img {
    height: 100%;
    width: 100%;
    object-fit: cover;
}
.bd li .text h4 {
    margin-bottom: 13px;
    height: 40px;
    font-size: 14x;
    line-height: 20px;
    font-weight: 400;
}
.bd li .text p {
    font-size: 14px;
    height: 20px;
    color: #999;
}
.bd li .text p span {
    color: #fa6400;
}
.bd li .text p i {
    font-style: normal;
}
.hd ul {
    display: flex;
}
.hd li {
    margin-right: 60px;
    font-size: 16px;
}
.hd .active {
    color: #00a4ff;
}
.bd {
    display: flex;
    justify-content: space-between;
}
.bd .left {
    width: 228px;
    height: 386px;
    background-color: pink;
}
.bd img {
    height: 100%;
    width: 100%;
    object-fit: cover;
}
.bd .right {
    width: 957px;
}
.bd .right .top{
    margin-bottom: 15px;
    height: 100px;
}
.footer {
    margin-top: 60px;
    padding-top: 60px;
    height: 273px;
    background-color: #fff;
}
.footer .wrapper {
    display: flex;
    justify-content: space-between;
}
.footer .left {
    width: 440px;
}
.footer .left p{
    margin-top: 24px;
    margin-bottom: 14px;
    font-size: 12px;
    line-height: 17px;
    color: #666;
}
.footer .left .download {
    display: block;
    width: 150px;
    height: 36px; 
    border: 1px solid #00a4ff;
    text-align: center;
    line-height: 34px;
    font-size: 16px;
    color: #00a4ff;
}
.footer .right {
    display: flex;
}
.footer .right dl {
    margin-right: 130px;
}
.footer .right dt {
    margin-bottom: 12px;
    font-size: 16px;
    line-height: 23px;
}
.footer .right a {
    font-style: 14px;
    color: #666;
    line-height: 24px;
}
相关推荐
也无晴也无风雨1 小时前
深入剖析输入URL按下回车,浏览器做了什么
前端·后端·计算机网络
Martin -Tang1 小时前
Vue 3 中,ref 和 reactive的区别
前端·javascript·vue.js
FakeOccupational3 小时前
nodejs 020: React语法规则 props和state
前端·javascript·react.js
放逐者-保持本心,方可放逐3 小时前
react 组件应用
开发语言·前端·javascript·react.js·前端框架
曹天骄4 小时前
next中服务端组件共享接口数据
前端·javascript·react.js
阮少年、4 小时前
java后台生成模拟聊天截图并返回给前端
java·开发语言·前端
郝晨妤6 小时前
鸿蒙ArkTS和TS有什么区别?
前端·javascript·typescript·鸿蒙
AvatarGiser6 小时前
《ElementPlus 与 ElementUI 差异集合》Icon 图标 More 差异说明
前端·vue.js·elementui
喝旺仔la6 小时前
vue的样式知识点
前端·javascript·vue.js
别忘了微笑_cuicui6 小时前
elementUI中2个日期组件实现开始时间、结束时间(禁用日期面板、控制开始时间不能超过结束时间的时分秒)实现方案
前端·javascript·elementui