我爱编程菜鸟前端工程师

html+css学习笔记021-结业(静态网站布局-努比亚)

2018-06-15  本文已影响5人  Mr柳上原

Author:Mr.柳上原

不要忘记自己当初学前端的目的

......

html部分:

<!doctype html> <!-- 网页申明:html标准文档 -->
<html lang='en'> <!-- 网页框架:英文 -->
 <head> <!-- 网页头部:网页定义区域 -->
  <meta charset='UTF-8'> <!-- 文字编码:国际通用 -->
  <meta name='Keywords' content='努比亚商城,北京努比亚,努比亚官网'> <!-- 关键词:搜索优化 -->
  <meta name='Description' content='努比亚(nubia),新锐智能手机品牌,定位高端市场,立足中国面向全球,以“Be Yourself”为品牌理念。努比亚手机产品拥有诸多单反级摄影功能,被称为“可以拍星星的手机”。努比亚在业内首创了“全网通”,并通过搭载FiT交互技术的全球首款“无边框手机”nubia Z9为广大用户认可。世界足坛巨星C·罗纳尔多任努比亚品牌代言人。'> <!-- 网页描述:网页简介 -->
  <meta name='Author' content='Mr.柳上原'> <!-- 网页开发者:我自己 -->
  <title>前端59期html+css结业《努比亚商城》</title> <!-- 网页标题:可见标题栏 -->
  <link rel='shortcut icon' type='images/x-icon' href='./icons/bitbug_favicon.ico'/> <!-- 网页标题图标 -->
   <link rel='stylesheet' type='text/css' href='./css/base.css'/>
  <link rel='stylesheet' type='text/css' href='./css/index.css'/> <!-- 外链样式表:给我的下任看的 -->
  <!-- 

        标准键盘布局 
        ┌───┐   ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┬───┐ ┌───┬───┬───┐ 
        │Esc│   │ F1│ F2│ F3│ F4│ │ F5│ F6│ F7│ F8│ │ F9│F10│F11│F12│ │P/S│S L│P/B│  ┌┐    ┌┐    ┌┐ 
        └───┘   └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┴───┘ └───┴───┴───┘  └┘    └┘    └┘ 
        ┌───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───┬───────┐ ┌───┬───┬───┐ ┌───┬───┬───┬───┐ 
        │~ `│! 1│@ 2│# 3│$ 4│% 5│^ 6│& 7│* 8│( 9│) 0│_ -│+ =│ BacSp │ │Ins│Hom│PUp│ │N L│ / │ * │ - │ 
        ├───┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─────┤ ├───┼───┼───┤ ├───┼───┼───┼───┤ 
        │ Tab │ Q │ W │ E │ R │ T │ Y │ U │ I │ O │ P │{ [│} ]│ | \ │ │Del│End│PDn│ │ 7 │ 8 │ 9 │   │ 
        ├─────┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴┬──┴─────┤ └───┴───┴───┘ ├───┼───┼───┤ + │ 
        │ Caps │ A │ S │ D │ F │ G │ H │ J │ K │ L │: ;│" '│ Enter  │               │ 4 │ 5 │ 6 │   │ 
        ├──────┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴─┬─┴────────┤     ┌───┐     ├───┼───┼───┼───┤ 
        │ Shift  │ Z │ X │ C │ V │ B │ N │ M │< ,│> .│? /│  Shift   │     │ ↑ │     │ 1 │ 2 │ 3 │   │ 
        ├─────┬──┴─┬─┴──┬┴───┴───┴───┴───┴───┴──┬┴───┼───┴┬────┬────┤ ┌───┼───┼───┐ ├───┴───┼───┤ E││ 
        │ Ctrl│    │Alt │         Space         │ Alt│    │    │Ctrl│ │ ← │ ↓ │ → │ │   0   │ . │←─┘│ 
        └─────┴────┴────┴───────────────────────┴────┴────┴────┴────┘ └───┴───┴───┘ └───────┴───┴───┘ 
         
        //                  写字楼里写字间,写字间里程序员;  
        //                  程序人员写程序,又拿程序换酒钱。  
        //                  酒醒只在网上坐,酒醉还来网下眠;  
        //                  酒醉酒醒日复日,网上网下年复年。  
        //                  但愿老死电脑间,不愿鞠躬老板前;  
        //                  奔驰宝马贵者趣,公交自行程序员。  
        //                  别人笑我忒疯癫,我笑自己命太贱;  
        //                  不见满街漂亮妹,哪个归得程序员?  
         
    -->
  <style type='text/css'> /* 内部样式表:给自己看的,懒得切换css表,做完后会全部注释掉 */

  </style>  
</head>
<body>
    <!--顶部区-->
    <div class='top'>
        <div class='top_in'>
            <div class='top_left'>
                <h1>
                    <a href='javascript:;' title='努比亚'></a>
                </h1>
            </div>
            <div class='top_right'>
                <ul class='top_nav'>
                    <li>
                        <a href='javascript:;'>首页</a>
                    </li>
                    <li>
                        <a href='javascript:;'>商城</a>
                    </li>
                    <li>
                        <a href='javascript:;'>产品</a>
                    </li>
                    <li>
                        <a href='javascript:;'>应用</a>
                    </li>
                    <li>
                        <a href='javascript:;'>服务</a>
                    </li>
                    <li>
                        <a href='javascript:;'>体验店</a>
                    </li>
                    <li>
                        <a href='javascript:;'>社区</a>
                    </li>
                </ul>
                <ul class='top_login'>
                    <li>
                        <a href='javascript:;'>登陆</a>
                    </li>
                    <li>
                        <a href='javascript:;'>注册</a>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <!--广告区-->
    <div class='banner'>
        <div class='nav_out'>
            <div class='nav'>
                <ul>
                    <li>
                        <a href='javascript:;'>
                            <img src='./images/nav-phone1.png' alt='新款'/>
                        </a>
                        <p>z11S mini <span style='color:red;'>新款</span></p>
                    </li>
                    <li>
                        <a href='javascript:;'>
                            <img src='./images/nav-phone2.png' alt='新款'/>
                            <p>z11</p>
                        </a>
                    </li>
                    <li>
                        <a href='javascript:;'>
                            <img src='./images/nav-phone3.png' alt='新款'/>
                            <p>z11 Max</p>
                        </a>
                    </li>
                    <li>
                        <a href='javascript:;'>
                            <img src='./images/nav-phone4.png' alt='新款'/>
                            <p>z11 mini</p>
                        </a>
                    </li>
                    <li>
                        <a href='javascript:;'>
                            <img src='./images/nav-phone5.png' alt='新款'/>
                            <p>N1</p>
                        </a>
                    </li>
                    <li>
                        <a href='javascript:;'>
                            <img src='./images/nav-phone6.png' alt='新款'/>
                            <p>布拉格S</p>
                        </a>
                    </li>
                    <li>
                        <a href='javascript:;'>
                            <img src='./images/nav-phone7.png' alt='新款'/>
                            <p>my 布拉格</p>
                        </a>
                    </li>
                </ul>
            </div>
        </div>
        <div class='figure'>
            <img src='./images/banner.jpg' alt='新款'/>
            <ol>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
                <li></li>
            </ol>
        </div>
        <div class='video'>
            <ul>
                <li>
                    <img src='./images/video1.jpg' alt='新款'/>
                    <div class='video_info'>
                        <img src='./images/nb-pro-video-ico-s.png' alt='新款'/>
                        <h3>z11 黑金版</h3>
                        <p>产品视频</p>
                    </div>
                </li>
                <li>
                    <img src='./images/video2.jpg' alt='新款'/>
                    <div class='video_info'>
                        <img src='./images/nb-pro-video-ico-s.png' alt='新款'/>
                        <h3>z11 黑金版</h3>
                        <p>产品视频</p>
                    </div>
                </li>
                <li>
                    <img src='./images/video3.jpg' alt='新款'/>
                    <div class='video_info'>
                        <img src='./images/nb-pro-video-ico-s.png' alt='新款'/>
                        <h3>z11 黑金版</h3>
                        <p>产品视频</p>
                    </div>
                </li>
            </ul>
        </div>
    </div>
    <!--内容去-->
    <div class='content'>
        <dl>
            <dt>
                <h3>最新产品</h3>
                <p>查看全部手机&raquo;</p>
            </dt>
            <dd>
                <ul class='content_phone'>
                    <li>
                        <img src='./images/con-phone1.jpg' alt='新款'/>
                        <div class='phone_des'>
                            <h4>Z11极光蓝</h4>
                            <p>激光蓝</p>
                            <span>一探究竟</span>
                        </div>
                    </li>
                    <li>
                        <img class='img_scale' src='./images/con-phone2.jpg' alt='新款'/>
                        <div class='phone_des'>
                            <h4>nobia z11 miniS</h4>
                            <p>手机摄影专家</p>
                            <span>一探究竟</span>
                        </div>
                    </li>
                    <li>
                        <img src='./images/con-phone3.jpg' alt='新款'/>
                        <div class='phone_des'>
                            <h4>nobia z11咖啡金</h4>
                            <p>无边框旗舰手机</p>
                            <span>一探究竟</span>
                        </div>
                    </li>
                    <li>
                        <img class='img_scale' src='./images/con-phone4.jpg' alt='新款'/>
                        <div class='phone_des'>
                            <h4>nobia z11 Max</h4>
                            <p>大不同</p>
                        </div>
                    </li>
                    <li>
                        <img class='img_scale' src='./images/con-phone5.jpg' alt='新款'/>
                        <div class='phone_des'>
                            <h4>nobia z11 mini</h4>
                            <p>小世界大精彩</p>
                        </div>
                    </li>
                </ul>
            </dd>
            <dt>
                <h3>精选配件</h3>
                <p>查看全部配件&raquo;</p>
            </dt>
            <dd>
                <ul class='content_product'>
                    <li>
                        <img src='./images/accessories1.jpg' alt='新款'/>
                        <p>努比亚快充移动电源</p>
                    </li>
                    <li>
                        <img src='./images/accessories2.jpg' alt='新款'/>
                        <p>努比亚圆铁耳机</p>
                    </li>
                    <li>
                        <img src='./images/accessories3.jpg' alt='新款'/>
                        <p>努比亚快炫美自拍杆</p>
                    </li>
                    <li>
                        <img src='./images/accessories4.jpg' alt='新款'/>
                        <p>nubia摄影三脚架</p>
                    </li>
                </ul>
            </dd>
        </dl>
    </div>
    <!--底部区-->
    <div class='footer'>
        <div class='footer_in'>
            <div class='footer_top'>
                <img src='./images/nb-pro-ft-logo-x2.jpg' alt='新款'/>
                > 全部机型
                <div class='footer_content'>
                    <dl>
                        <dt>Z系列</dt>
                        <dd>
                            <a href='javascript:;'>nubia Z11</a>
                        </dd>
                        <dd>
                            <a href='javascript:;'>nubia Z11 Max</a>
                        </dd>
                        <dd>
                            <a href='javascript:;'>nubia Z11 mini</a>
                        </dd>
                    </dl>
                    <dl>
                        <dt>M系列</dt>
                        <dd>
                            <a href='javascript:;'>nubia 布拉格S</a>
                        </dd>
                        <dd>
                            <a href='javascript:;'>nubia</a>
                        </dd>
                    </dl>
                    <dl>
                        <dt>配件</dt>
                        <dd>
                            <a href='javascript:;'>保护壳</a>
                        </dd>
                        <dd>
                            <a href='javascript:;'>皮套</a>
                        </dd>
                        <dd>
                            <a href='javascript:;'>贴膜</a>
                        </dd>
                        <dd>
                            <a href='javascript:;'>耳机</a>
                        </dd>
                        <dd>
                            <a href='javascript:;'>数据线/充电器</a>
                        </dd>
                        <dd>
                            <a href='javascript:;'>周边产品</a>
                        </dd>
                    </dl>
                </div>
            </div>
            <div class='footer_bottom'>
                <ul class='footer_copyright'>
                    <li>
                        <a href='javascript:;'>关于我们</a> |
                    </li>
                    <li>
                        <a href='javascript:;'>联系我们</a> |
                    </li>
                    <li>
                        <a href='javascript:;'>新闻中心</a> |
                    </li>
                    <li>
                        <a href='javascript:;'>加入我们</a> |
                    </li>
                    <li>
                        <a href='javascript:;'>合作注册</a>|
                    </li>
                    <li>
                        <a href='javascript:;'>公益</a> |
                    </li>
                    <li>
                        <a href='javascript:;'>以旧换新</a> |
                    </li>
                    <li>
                        <a href='javascript:;'>问题反馈</a> |
                    </li>
                    <li>
                        <a href='javascript:;'>简体中文</a> |
                    </li>
                </ul>
                <ul class='footer_social'>
                    <li>
                        <a href='javascript:;'></a>
                    </li>
                    <li>
                        <a href='javascript:;'></a>
                    </li>
                    <li>
                        <a href='javascript:;'></a>
                    </li>
                </ul>
            </div>
        </div>
    </div>
</body>
</html>

css部分1,base.css:

@charset "utf-8";
/* 清空默认样式 */
html{
    color:#000;
    background:#FFF;
}
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,textarea,p,blockquote,th,td{
    margin:0;
    padding:0;
}
table{
    border-collapse:collapse;
    border-spacing:0;
}
fieldset,img{
    border:0;
}
address,caption,cite,code,dfn,em,strong,th,var{
    font-style:normal;
    font-weight:normal;
}
ol,ul{
    list-style:none;
}
caption,th{
    text-align:left;
}
h1,h2,h3,h4,h5,h6{
    font-size:100%;
    font-weight:normal;
}
q:before,q:after{
    content:'';
}
abbr,acronym{
    border:0;
    font-variant:normal;
}
sup{
    vertical-align:text-top;
}
sub{
    vertical-align:text-bottom;
}
input,textarea,select{
    font-family:inherit;
    font-size:inherit;
    font-weight:inherit;
    *font-size:100%;
}
legend{
    color:#000;
}
a{
    text-decoration:none;
    color:#999;
}
/*设置全局样式*/
body{
    font-family: "微软雅黑";
    font-size: 12px;
    color: #999;
    background-color: #f5f5f5;
}

css部分2,index.css:

@charset "utf-8";
/* 头部开始 */
.top{
    height:60px;
    background-color:black;
}
.top .top_in{
    width:1200px;
    height:100%;
    margin:0px auto;
}
.top .top_left{
    float:left;
    height:100%;
    width:190px;
    overflow:hidden;
}
.top .top_left > h1{
    width:100%;
    height:100%;
}
.top .top_left > h1 a{
    display:inline-block;
    width:100%;
    height:100%;
    background:url('../images/nubia-logo.png');
}
.top .top_right{
    float:right;
    height:100%;
    width:740px;
}
.top .top_nav{
    float:left;
    width:550px;
    height:100%;
}
.top .top_nav > li{
    float:left;
}
.top .top_nav > li > a{
    font-size:16px;
    font-weight:bold;
    color:#ccc;
    text-align:center;
    line-height:60px;
    margin-left:40px;
}
.top ul > li > a:hover{
    color:#e82707;
}
.top .top_login{
    float:right;
    width:150px;
    height:100%;
}
.top .top_login > li{
    float:right;
    text-align:center;
    line-height:60px;
    margin-left:10px;
}
.top .top_login > li:nth-child(3){
    width:30px;
    height:30px;
    background:url('../images/nubia-syb-all.png');
    margin-top:15px;
}
.top .top_login > li > a{
    font-size:16px;
    font-weight:bold;
    color:#ccc;
}
/* 广告区 */
.banner{
    height:860px;
}
.banner .nav_out{
    width:100%;
    height:121px;
    position:absolute;
    background-color:#fff;
    z-index:998;
}
.banner .nav{
    height:121px;
    width:1200px;
    margin:0px auto;
}
.banner .nav > ul{
    width:100%;
    height:100%;
    margin:0px auto;
    padding-left:75px;
    padding-right:75px;
    box-sizing:border-box;
}
.banner .nav > ul > li{
    float:left;
    width:150px;
    height:100%;
    text-align:center;
}
.banner .nav > ul > li img{
    width:120px;
    height:80px;
    margin-top:15px;
}
.banner .nav > ul > li:hover{
    border-bottom:2px solid red;
    box-sizing:border-box;
}
.banner .figure{
    height:600px;
    width:100%;
    background-color:#fff;
    text-align:center;
    overflow:hidden;
    position:relative;
}
.banner .figure > img{
    height:100%;
    margin:0px -100%;
}
.banner .figure > ol{
    width:150px;
    height:20px;
    position:absolute;
    left:50%;
    margin-left:-75px;
    bottom:10px;
}
.banner .figure > ol > li{
    border-radius:50%;
    float:left;
    width:8px;
    height:8px;
    background-color:#cccccc;
    margin-left:15px;
    border:2px solid transparent;
    transition:border 1s;
}
.banner .figure > ol > li:hover{
    border:2px solid red;
    background-color:transparent;
    transform:scale(1.2,1.2);
}
.banner .video{
    width:1200px;
    height:250px;
    margin:0 auto;
    margin-top:10px;
    background-color:#ff6247;
}
.banner .video > ul{
    width:100%;
    height:100%;
    background-color:forestgreen;
}
.banner .video > ul > li{
    width:396px;
    height:250px;
    float:left;
    margin-right:3px;
    text-align:center;
    overflow:hidden;
    position:relative;
    background-color:black;
}
.banner .video > ul > li > img{
    height:100%;
    margin:0 -100%;
}
.banner .video .video_info{
    width:100%;
    height:155px;
    position:absolute;
    bottom:0;
    opacity:0;
    transition:opacity 1s;
}
.banner .video .video_info > h3{
    font-size:16px;
    line-height:40px;
    color:white;
}
.banner .video .video_info > p{
    color:white;
}
.banner .video > ul > li:hover .video_info{
    opacity:1;
}
.banner .video > ul > li:hover >img{
    opacity:0.5;
}
.banner .video > ul > li:hover .video_info >img{
    animation:sport 2s .5s ease-in-out infinite;
}
@keyframes sport{
    20%{transform: scale(.8);}
    40%{transform: scale(1.2);}
    60%{transform: scale(.9);}
    80%{transform: scale(1);}
    100%{transform: scale(1);}
}
/* 内容区 */
.content{
    height:1883px;
}
.content > dl{
    width:1200px;
    height:100%;
    margin:0 auto;
    overflow:hidden;
}
.content > dl > dt{
    text-align:center;
    margin-top:40px;
    margin-bottom:30px;
}
.content > dl > dt > h3{
    font-size:35px;
    color:#333;
    margin-bottom:20px;
}
.content > dl > dt > p{
    color:#e8304e;
    margin-top:20px;
}
.content .content_phone{
    width:1200px;
    height:1200px;

}
.content .content_phone > li{
    float:left;
    background-color:#fff;
    position:relative;
    overflow:hidden;
}
.content .content_phone > li:nth-child(1){
     width:1200px;
     height:395px;
    margin-bottom:10px;
 }
.content .content_phone > li:nth-child(2){
    width:395px;
    height:795px;
    margin-right:10px;
}
.content .content_phone > li:nth-child(3){
    width:795px;
    height:390px;
    margin-bottom:10px;
}
.content .content_phone > li:nth-child(4){
    width:390px;
    height:395px;
    margin-right:10px;
}
.content .content_phone > li:nth-child(5){
    width:395px;
    height:395px;
}
.content .content_phone > li > img{
    width:100%;
    transition:all 1s;
}
.content .content_phone > li:nth-child(1) > img{
    margin-top:60px;
}
.content .content_phone .phone_des{
    width:200px;
    position:absolute;
    left:50%;
    margin-left:-100px;
    bottom:10px;
    text-align:center;
}
.content .content_phone .phone_des > h4{
    font-size:20px;
    color:#000;
}
.content .content_phone .phone_des > p{
    font-size:15px;
    margin-bottom:10px;
    color:#999999;
}
.content .content_phone .phone_des > span{
    display:inline-block;
    width:108px;
    height:32px;
    text-align:center;
    line-height:32px;
    border:1px solid #ccc;
    border-radius:10px;
    color:#000;
}
.content .content_phone > li:nth-child(1) .phone_des{
    left:0%;
    margin-left:800px;
    bottom:150px ;
}
.content .content_phone > li:nth-child(1) img{
    margin-left:-100px;
}
.content .content_phone > li:nth-child(1):hover img {
    margin-left:0;
}
.content .content_phone > li:nth-child(3) img{
    margin-left:100px;
}
.content .content_phone > li:nth-child(3):hover img {
    margin-left:0;
}
.content .content_phone > li:hover .img_scale{
    transform:scale(1.2,1.2);
}
.content .content_product{
    width:1200px;
    height:300px;
    display:flex;
    justify-content:space-between;
}
.content .content_product > li{
    width:295px;
    height:300px;
    float:left;
    background-color:white;
    margin-left:4px;
    overflow:hidden;
}
.content .content_product > li > img{
    width:100%;
    transition:all 1s;
}
.content .content_product > li > p{
    margin-top:20px;
    text-align:center;
}
.content .content_product > li:hover img{
    transform:scale(1.2,1.2);
}
/* 底部区 */
.footer{
    height:396px;
}
.footer .footer_top{
    width:1200px;
    border-top:1px solid #ccc;
    margin:0 auto;
}
.footer .footer_content{
    margin-top:20px;
    padding-left:100px;
    overflow:hidden;
}

.footer .footer_content > dl{
    float:left;
    width:200px;
}
.footer .footer_content > dl > dt{
    color:#000;
    font-size:14px;
    line-height:30px;
}
.footer .footer_content > dl > dd{
    line-height:20px;
}
.footer .footer_content > dl > dd a:hover{
    color:red;
}

.footer .footer_copyright{
    list-style:none;
    float:left;
    margin-top:10px;
}
.footer .footer_copyright > li{
    float:left;
    padding:10px;
    font-size:10px;
    margin-left:10px;
}
.footer .footer_copyright > li:hover a{
    color:#000;
}
.footer .footer_social{
    float:left;
    margin-left:50px;
    list-style:none;
    margin-top:10px;
    font-size:20px;
}
.footer .footer_social > li{
    float:left;
    width:30px;
    height:30px;
    margin-right:10px;
}
.footer .footer_social > li a{
    display:inline-block;
    width:30px;
    height:30px;
    background:url('../images/nubia-syb-all.png');
}
.footer .footer_social > li:nth-child(1) a{
    background-position:-246px 0;
}
.footer .footer_social > li:nth-child(2) a{
    background-position:-186px 0;
}
.footer .footer_social > li:nth-child(3) a{
    background-position:-126px 0;
}
.footer .footer_social > li:nth-child(4) a{
    background-position:-156px 0;
}
.footer .footer_info{
    float:left;
    font-size:10px;
    line-height:30px;
}
.footer .footer_bottom{
    width:740px;
    margin:0px auto;
}
上一篇下一篇

猜你喜欢

热点阅读