京东左侧导航条练习

Posted by xiongmao; tagged with none

jdleft.png

<!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>Document</title>
    <!--reset.css-->
    <link rel="stylesheet" href="../_layout/css/reset.css">
    <link rel="stylesheet" href="./CSS/02.CSS">           
</head>
<body>
    <ul class="a-list">
        <li class="li-list">
            <a href="javascript:;">家用电器</a>
        </li>
        <li class="li-list">
            <a href="javaScript:;">手机</a>
            <!--em可加也可以不加,em为语义化标签,暂不造成影响
            本人第一想法使用em进行设置/,但是根据3.cn又改成span元素
            -->
            <span>/</span>
            <a href="javaScript:;">运营商</a>
            <span>/</span>
            <a href="javaScript:;">数码</a>
        </li>
        <li class="li-list">
            <a href="javaScript:;">电脑</a>
            <span>/</span>
            <a href="javaScript:;">办公</a>
        </li>
        <li class="li-list">
            <a href="javaSctipt:;">家居</a>
            <span>/</span>
            <a href="javaScript:;">家具</a>
            <span>/</sspan>
            <a href="javaScript:;">家装</a>
            <span>/</span>
            <a href="javaScript:;">厨具</a>
        </li>
        <li class="li-list">
            <a href="javaScript:;">男装</a>
            <span>/</span>
            <a href="javaScript:;">女装</a>
            <span>/</span>
            <a href="javaScript:;">童装</a>
            <span>/</span>
            <a href="javaScript:;">内衣</a>
        </li class="li-list">
        <li class="li-list">
            <a href="javaScript:;">美妆</a>
            <span>/</span>
            <a href="javaScript:;">个人清洁</a>
            <span>/</span>
            <a href="javaScript:;">宠物</a>
            
        </li>
        <li class="li-list">
            <a href="javaScript:;">女鞋</a>
            <span>/</span>
            <a href="javaScript:;">箱包</a>
            <span>/</span>
            <a href="javaScript:;">钟表</a>
            <span>/</span>
            <a href="javaScript:;">珠宝</a>
        </li>
        <li class="li-list">
            <a href="javaScript:;">男鞋</a>
            <span>/</span>
            <a href="javaScript:;">运动</a>
            <span>/</span>
            <a href="javaScript:;">户外</a>
        </li>
        <li class="li-list">
            <a href="javaScritp:;">房产</a>
            <span>/</span>
            <a href="javaScritp:;">汽车</a>
            <span>/</span>
            <a href="javaScritp:;">汽车用品</a>
        </li>
        <li class="li-list">
            <a href="JavaScript:;">母婴</a>
            <span>/</span>
            <a href="JavaScript:;">玩具乐器</a>
        </li>
        <li class="li-list">
            <a href="javaScript:;">食品</a>
            <span>/</span>
            <a href="javaScript:;">酒类</a>
            <span>/</span>
            <a href="javaScript:;">生鲜</a>
            <span>/</span>
            <a href="javaScript:;">特产</a>
        </li>
        <li class="li-list">
            <a href="javaScript:;">艺术</a>
            <span>/</span>
            <a href="javaScript:;">礼品鲜花</a>
            <span>/</span>
            <a href="javaScript:;">农资绿植</a>
        </li>
        <li class="li-list">
            <a href="javaScript:;">医药保健</a>
            <span>/</span>
            <a href="javaScript:;">计生情趣</a>
        </li>

    </ul>
</body>
</html>

css

body{
    background-color: #F4F4F4;
}
.a-list{
    width: 190px;
   
    padding: 10px 0;
   /*背景颜色为white但是由于白色不明显决定,将整个body改成其他颜色,开发的时候不需要*/
    background-color:white;
}
.a-list .li-list{
    height: 25px;
    padding-left: 10px;
    /*如果想让文字在父元素中垂直居中,只需要设置line-height和父元素一样高度即可*/
    line-height: 25px;;
}
/*hover
设置鼠标经过时的变化
*/
.li-list:hover{
    
    background-color: #F4F4F4;
}
.li-list a{
    text-decoration: none;
    color: black; 
    font-size: 14px; 
}

reset.css(重置浏览器默认样式)

/*去除浏览器部分默认样式*/
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed, 
figure, figcaption, footer, header, hgroup, 
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
    margin: 0;
    padding: 0;
    border: 0;
    font-size: 100%;
    font: inherit;
    vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure, 
footer, header, hgroup, menu, nav, section {
    display: block;
}
body {
    line-height: 1;
}
ol, ul {
    list-style: none;
}
blockquote, q {
    quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
    content: '';
    content: none;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}
a{
    text-decoration: none;
}