CSS实战项目之商品列表

HTML代码
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>商品列表</title>
    <link rel="stylesheet" type="text/css" href="css/post4.css">
</head>
<body>

<!--第一行-->
<div class="tab-top">
    全部商品分类
</div>
<div class="tab-grandpa">
<!--下面的内容-->
<div class="tab-parent">
    <ul class="tab-child">
        <li class="tab">
            <a href="#">家用、电器  ></a>
            <div class="content">1</div>
        </li>
    </ul>
    <ul class="tab-child">
        <li class="tab">
            <a href="#">电脑、办公  ></a>
            <div class="content">2</div>
        </li>
    </ul>
    <ul class="tab-child">
        <li class="tab">
            <a href="#">电脑、办公  ></a>
            <div class="content">3</div>
        </li>
    </ul>
    <ul class="tab-child">
        <li class="tab">
            <a href="#">电脑、办公  ></a>
            <div class="content">4</div>
        </li>
    </ul>
    <ul class="tab-child">
        <li class="tab">
            <a href="#">电脑、办公  ></a>
            <div class="content">5</div>
        </li>
    </ul>
    <ul class="tab-child">
        <li class="tab">
            <a href="#">电脑、办公  ></a>
            <div class="content">6</div>
        </li>
    </ul>
    <ul class="tab-child">
        <li class="tab">
            <a href="#">电脑、办公  ></a>
            <div class="content">7</div>
        </li>
    </ul>
    <ul class="tab-child">
        <li class="tab">
            <a href="#">电脑、办公  ></a>
            <div class="content">8</div>
        </li>
    </ul>
</div>
</div>
</body>
</html>

CSS代码

html,body{
    font-family: '新宋体';
}
.tab-top{
    color: white;
    font-size: 20px;
    background-color: red;
    text-align: center;
    line-height: 30px;
    height: 30px;
    width: 200px;
    border: 1px solid #ffffff;
    position: relative;
}
.tab-grandpa{
    float: top;
    border: 1px solid red;
    position: relative;
    height: 200px;
}
.tab-grandpa .tab-parent{
    margin: 0px;
    padding: 0px;
    font-size: 20px;
    float: top;
    border: 1px solid #ffffff;
    height: 20px;
}
.tab-grandpa .tab-parent .tab-child{
    margin: 0px;
    padding: 0px;
    list-style: none;
}
.tab-grandpa .tab-parent .tab-child .tab{
    margin: 0px;
    padding: 0px;
    border: 0px;
    float: top;
}
.tab-grandpa .tab-parent .tab-child .tab a{
    color: white;
    margin: 0px;
    padding: 0px;
    background-color: red;
    height: 25px;
    width: 100px;
    border: 1px solid #fff;
    text-align: center;
    line-height: 25px;
    text-decoration: none;
    border-right: 1px solid red;
    display: inline;
}
.tab-grandpa .tab-parent .tab-child .tab:hover a{
    color: red;
    background-color: white;
    border-right: 1px solid #fff;
}
.tab-grandpa .tab-parent .tab-child .tab:hover .content{
    display: inline;
}
.tab-grandpa .tab-parent .tab-child .tab .content{
    /*背景色*/
    background-color: lightsteelblue;
    width: 200px;
    height: 199px;
    border: 1px solid;
    border-left: none;
    color: red;
    font-size: 100px;
    position: absolute;
    left: 124px;
    top: 0px;
    text-align: center;
    line-height: 200px;
    display: none;
}

效果图:

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值