自学前端——第七天(综合案例)

以下是header和banner部分的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>学成在线首页</title>
    <link rel="stylesheet" href="style.css">
</head>

<body>
    <!-- 头部区域开始 -->
    <div class="headerbox w">
        <div class="xclogo"><img src="images/logo.png" alt="logo" /></div>
        <!-- <div class="box1 headerbox2inner">首页</div>
        <div class="headerbox2">
            <span class="headerbox2inner box2">课程</span>
            <span class="headerbox2inner box3">职业规划</span>
        </div> -->
        <!-- 导航栏要写在li里 -->
        <ul class="headerbox2">
            <li class="flo"><a href="#">首页</a></li>
            <li class="flo header2li2"><a href="#">课程</a></li>
            <li class="flo"><a href="#">职业规划</a></li>
        </ul>
        <div class="headerbox3">
            <input type="text" placeholder="输入关键词" />
            <button><img src="images/fa-search.png" alt="search"></button>
        </div>
        <div class="headerbox4">
            <img src="images/20130502185029_EkKYh拷贝.png" alt="photo">
            username
        </div>
    </div>
    <!-- 头部区域结束 -->
    <!-- banner部分开始 -->
    <div class="bannerbg">
        <div class="bannerinner w">
            <!-- <div class="bannerleft">
                <a href="#">前端开发</a>
                <a href="#">后端开发</a>
                <a href="#">移动开发</a>
                <a href="#">人工智能</a>
                <a href="#">商业预测</a>
                <a href="#">云计算&大数据</a>
                <a href="#">运维&从测试</a>
                <a href="#">UI设计</a>
                <a href="#">产品</a>
            </div> -->
            <!-- 上面的做法是不把a放进li里,想使用需要更改css文件里的.bannerleft a -->
            <ul class="bannerleft">
                <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="#">UI设计<span>></span></a></li>
                <li><a href="#">产品<span>></span></a></li>
            </ul>
            <div class="bannerright">
                <div class="br-top">我的课程表</div>
                <div class="br-bottom">
                    <div class="box">
                        <span class="bigger">继续学习</span>
                        <span class="normal">程序语言设计</span>
                        <div class="smaller">正在学习-使用对象</div>
                    </div>
                    <div class="box">
                        <span class="bigger">继续学习</span>
                        <span class="normal">程序语言设计</span>
                        <div class="smaller">正在学习-使用对象</div>
                    </div>
                    <div class="box">
                        <span class="bigger">继续学习</span>
                        <span class="normal">程序语言设计</span>
                        <div class="smaller">正在学习-使用对象</div>
                    </div>
                    <a href="#">全部课程</a>
                </div>
            </div>
        </div>
    </div>
    <!-- banner部分结束 -->
</body>

</html>

 以下是header和banner部分的css文件:

* {
    padding: 0;
    margin: 0;
}

a {
    text-decoration: none;
    color: black;
}

li {
    list-style: none;
}

.w {
    width: 1200px;
    margin: 0px auto;
}

body {
    background-color: #f3f5f7;
}

.headerbox {
    height: 42px;
    /* background-color: grey; */
    margin: 30px auto;
    /* background: transparent url(images/logo.png) no-repeat scroll left; */
}

.xclogo img {
    float: left;
    /* display: ; */
    height: 42px;
    width: 200px;
    /* margin: 0px auto; */
}

.headerbox2 {
    float: left;
    /* width: 252px; */
    height: 42px;
    line-height: 42px;
    margin: 0px 66px;
    /* background-color: pink; */
    font-size: 18px;
}

.headerbox2 li a {
    display: inline-block;
    height: 42px;
    padding: 0px 10px;
}

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

.flo {
    float: left;
    /* padding: 0px 10px; */
}

.header2li2 {
    margin: 0px 25px;
}

.headerbox2inner {
    padding: 0px 10px;
}

.box1 {
    float: left;
    height: 42px;
    width: 36px;
    line-height: 42px;
    margin-left: 66px;
    border-bottom: 2px #00a4ff solid;
    font-size: 18px;
    /* background-color: pink; */
}

.box2 {
    margin: 0px 25px;
}

.box3 {
    margin: 0px 20px 0px 0px;
}

.headerbox3 {
    float: left;
    width: 411px;
    height: 40px;
}

.headerbox3 input {
    float: left;
    width: 345px;
    height: 40px;
    border: 1px #00a4ff solid;
    border-right: 0px;
    padding-left: 15px;
    outline: none;
}

.headerbox3 button {
    float: left;
    width: 50px;
    height: 42px;
    background-color: #00a4ff;
    border: none;
    /* background-image: url(images/fa-search.png); */
}

.headerbox4 {
    float: right;
    height: 42px;
    line-height: 42px;
    /* margin-right: 30px; */
    font-size: 14px;
    color: #666;
}

.bannerleft {
    /* margin: 0px auto 0px 0px; */
    float: left;
    width: 151px;
    height: 420px;
    padding: 0px 20px;
    line-height: 46px;
    font-size: 14px;
    background-color: rgb(0, 0, 0, .3);
}

.bannerleft a {
    display: block;
    height: 46px;
    width: 151px;
    /* 错误注释:上面的三行代码如果html文件里a是放在li里的则不用写,否则去掉会使几个a标签里的字挤在一起 */
    /* 正确注释:上面的三行代码的作用是使得a标签所在的一整个框都能用鼠标点击,不管有没有li都要加上 */
    /* line-height: 46px;
    font-size: 14px; */
    /* 上面2行代码可以直接放进.bannerleft里 */
    color: white;
}

.bannerleft a span {
    float: right;
}

.bannerleft a:hover {
    color: #00b4ff;
}

.bannerbg {
    height: 420px;
    background: #1c036c url(images/banner2.png) no-repeat scroll top;
}

.bannerinner {
    height: 420px;
    /* background-color: red; */
}

.bannerright {
    float: right;
    height: 300px;
    width: 228px;
    margin: 50px 0px 70px;
    background-color: white;
}

.br-top {
    height: 48px;
    /* width: 228px; */
    /* 由于宽度有bannerright限制,所以上面这句话可以不写 */
    background-color: #9bceea;
    color: white;
    font: 700 18px 'Microsoft YaHei';
    line-height: 48px;
    text-align: center;
    letter-spacing: 2px;
    /* 以上这行代码没讲,用处是设置字间距为2px */
}

.br-bottom {
    height: 252px;
    width: 200px;
    /* margin: auto; */
    padding: 0px 20px;
    /* background-color: red; */
}

.br-bottom .box {
    padding: 14px 0px;
    border-bottom: 1px solid #eaeaea;
}

.bigger {
    font-size: 16px;
    font-weight: 500;
    color: #4e4e4e;
}

.normal {
    font-size: 14px;
    font-weight: 500;
    color: #4e4e4e;
}

.smaller {
    font-size: 12px;
    font-weight: 500;
    color: #a5a5a5;
}

.br-bottom a {
    display: block;
    margin: 5px auto;
    height: 38px;
    /* width: 200px; */
    line-height: 38px;
    text-align: center;
    border: 1px solid #22b0ff;
    color: #22b0ff;
    font-size: 16px;
    font-weight: 700;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值