首页 > 其他分享 >学成在线项目-精品推荐模块

学成在线项目-精品推荐模块

时间:2022-12-07 23:25:03浏览次数:43  
标签:学成 right color float height 模块 精品 banner left

学成在线项目-精品推荐模块

思路:大盒子包含三个小盒子,左边精品推荐,中间用小li包含小a ,右边是修改盒子。分析完毕,开干。

1、效果图如下

2、html代码如下:

<!DOCTYPE html>
<html lang="en">
<head>
    <link rel="stylesheet" href="./css/index.css">
    <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>阿涛的学成在线</title>
</head>

<body>
    <!-- 网站的首页,所有网站的首页都叫index.html,因为服务器找首页都是找index.html -->
    <!-- 布局,从上到下,从左到右 -->
    <!-- css:浮动/display;盒子模型;文字样式 -->

    <!-- 头部header:负责头部区域的样式,wrapper只负责版心的效果 -->
    <div class="header wrapper">
        <h1>
            <a href="#"><img src="./images/logo.png" alt=""></a>
        </h1>

        <!-- 导航 -->
        <div class="nav">
            <ul>
                <li><a href="#">首页</a></li>
                <li><a href="#">课程</a></li>
                <li><a href="#">职业规划</a></li>
            </ul>
        </div>

        <!-- 搜索 -->
        <div class="search">
            <input type="text" placeholder="输入关键词"><button></button>
        </div>

        <!-- 用户 -->
        <div class="user">
            <img src="./images/user.png" alt="">
            <span>汪涛</span>
        </div>
    </div>

    <!-- ===============================第二篇博客的html代码===================-->
    <!-- 轮播图banner -->
    <div class="banner">
        <div class="wrapper">
            <div class="left">
                <ul>
                    <li><a href="#">前端开发<span>></span></a></li>
                    <li><a href="#">前端开发<span>></span></a></li>
                    <li><a href="#">前端开发<span>></span></a></li>
                    <li><a href="#">前端开发<span>></span></a></li>
                    <li><a href="#">前端开发<span>></span></a></li>
                    <li><a href="#">前端开发<span>></span></a></li>
                    <li><a href="#">前端开发<span>></span></a></li>
                    <li><a href="#">前端开发<span>></span></a></li>
                    <li><a href="#">前端开发<span>></span></a></li>
                </ul>
            </div>
            <div class="right">
                <h2>我的课程表</h2>
                <div class="content">
                    <dl>
                        <dt>继续学习 程序语言设计</dt>
                        <dd>正在学习-使用对象</dd>
                    </dl>
                    <dl>
                        <dt>继续学习 程序语言设计</dt>
                        <dd>正在学习-使用对象</dd>
                    </dl>
                    <dl>
                        <dt>继续学习 程序语言设计</dt>
                        <dd>正在学习-使用对象</dd>
                    </dl>
                </div>

                <a href="#" class="more">全部课程</a> 

            </div>
        </div>
    </div>
    <!-- ===============================第三篇博客的html代码===================-->

        <!-- 精品推荐 -->
    <div class="goods wrapper">
        <h2>精品推荐</h2>
        <ul>
            <li><a href="#">jQuery</a></li>
            <li><a href="#">jQuery</a></li>
            <li><a href="#">jQuery</a></li>
            <li><a href="#">jQuery</a></li>
            <li><a href="#">jQuery</a></li>
            <li><a href="#">jQuery</a></li>
        </ul>
        <a href="#" class="xingqu">修改兴趣</a>
    </div>
</body>

</html>

3、css部分的代码

/* index.css是用来美化首页的 */
* {
    margin: 0;
    padding: 0;
    /* 内减模式 */
    box-sizing: border-box;
}

/* 去除小li的前面的点 */
li {
    list-style: none;
}
/* 去掉超链接的下划线 */
a {
    text-decoration: none;
}

.clearfix:before,.clearfix:after {
    content:"";
    display:table; 
  }
  .clearfix:after {
    clear:both;
  }

.body {
    background-color: rgb(248, 245, 242);
}

.wrapper {
    width: 1200px;
    margin: 0 auto;
    /* background-color: antiquewhite; */
}

.header {
    height: 42px;
    margin: 30px auto;
}

h1{
    float: left;
}

/* 导航 */
.nav {
    float: left;
    margin-left: 70px;
    height: 42px;
}
.nav li {
    float: left;
    margin-right: 26px;
}

.nav li a {
    display: block;
    padding: 0 9px;
    height: 42px;
    line-height: 42px;
    /* border-bottom: 2px solid #00a4ff; */

    font-size: 18px;
    color: #050505;
}

/* 鼠标移动到标签上,变成蓝色 */
.nav li a:hover {
    border-bottom: 2px solid #00a4ff;
}

.search {
    float: left;
    margin-left: 59px;
    width: 412px;
    height: 40px;
    border: 1px solid #00a4ff;
}

.search input {
    float: left;
    padding-left: 20px;
    /* 左右加一起的尺寸要小于等于410 */
    width: 360px;
    height: 38px;
    border: 0;
}

/* 控制placeholder的样式 */
.search input::placeholder {
    font-size: 14px;
    color: #bfbfbf;
}

.search button {
    float: left;
    width: 50px;
    height: 38px;
    background-image: url(../images/btn.png);
    border: 0;
}

.user {
    float: right;
    margin-right: 35px;
    height: 42px;
    line-height: 42px;
}

.user img {
    /* 调节图片垂直对齐方式, middle:居中 */
    vertical-align: middle;
}
/*=============================第二篇博客==========================================*/
/* 轮播图  中间的蓝色的大背景*/
.banner {
    height: 420px;
    background-color: #1c036c;
}

/* 第二层的版心图宽度在wrapper中已经搞过了。自代会继承,就不需要单独设置 */
.banner .wrapper {
    height: 420px;
    background-image: url("../images/banner2.png");
}

.banner .wrapper .left {
    float: left;

    /* 文字离上下距离为0左右距离是20像素 */
    padding: 0 20px;

    width: 190px;
    height: 420px;
    /* 背景是黑色的,但是是0.3的透明度 */
    background-color: rgba(0,0,0, 0.3);

    /* 行高属于控制文字的属性, 能继承 */
    line-height: 44px;
}

.banner .left a {
    font-size: 14px;
    color: #fff;

}

.banner .left span {
    float: right;
}

.banner .left a:hover {
    color: #00a4ff;
}

.banner .right {
    /* 靠着右边浮动 */
    float: right;
    width: 228px;
    height: 300px;
    background-color: #FFF;
    /* 盒子离上边距离为50px */
    margin-top: 50px;
}

.banner .right h2 {
    /* 设置h2 标签的高度 */
    height: 48px;
    background-color: #9bceea;
    font-size: 18px;
    /* 设置字体的高度和h2的高度是一样的,就能实现居中 */
    line-height: 48px;
    text-align: center;
    color: white;
}

.banner .right .content {
    /*设置字体离边框的距离*/
    padding: 0 18px;
}

.banner .right .content dl {
    padding: 12px 0;
    border-bottom:2px solid #e5e5e5;
}

.banner .right .content dt {
    font-size: 16px;
    color: #4e4e4e;
}

.banner .right .content dd {
    font-size: 14px;
    color: #4e4e4e;
}

.banner .right .more {
    display: block;

    border: #00a4ff;
    margin: 0 20px;
    height: 40px;
    width: 200px;

    /* 设置边框 */
    border: 1px solid #00a4ff;

    margin-top: 10px;

    line-height: 40px;
    text-align: center;
}

/*=============================第三篇博客==========================================*/
/* 精品推荐模块css开发 */
.goods {
    height: 64px;
    /* 文字离两边还有点距离 */
    padding-left: 34px;
    padding-right: 26px;  
    /* 该模块和上面间隔8像素 */
    margin-top: 8px;
    /* 这个盒子还有一点阴影 */
    box-shadow: 0px 2px 3px 0px 
		rgba(118, 118, 118, 0.2);
    /* 由于文字在这个盒子里面都是居中的,所以只用在中间设置 行高 一次就行了 */
    line-height: 64px;
    }

.goods h2 {
    float: left;
    font-size: 16px;
    color: #00a4ff;
    padding-right: 20px;
}

.goods ul  {
    float: left;
}

/* 应为小Li也是块级元素,所以也需要浮动起来 */
.goods ul  li {
    float: left;
}


.goods ul  li a {
    font-size: 20px;
    padding: 0 30px;
    /* 设置边框左边的一条竖线 */
    border-left: 1px solid black;
    /* 设置字体为黑色 */
    color: #050505;
}

/* 设置鼠标经过小li中的标签时候,变色 */
.goods ul  li a:hover {
    color: #00a4ff;
}

.goods .xingqu {
    float: right;
    font-size: 14px;
    color: #00a4ff;
}

4、效果图如下:

标签:学成,right,color,float,height,模块,精品,banner,left
From: https://www.cnblogs.com/atao-BigData/p/16964875.html

相关文章