使用html和css的一些案列(小米官网)

1.小米导航栏

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>Document</title>
    <link rel="stylesheet" href="小米导航.css">
</head>
<body>
    <div id="body">
        <a href="">Xiaomi手机</a>
        <a href="">Redmi手机</a>
        <a href="">电视</a>
        <a href="">笔记本</a>
        <a href="">平板</a>
        <a href="">家电</a>
        <a href="">路由器</a>
        <a href="">服务中心</a>
        <a href="">社区</a>
    </div>
</body>
</html>

css部分

*{
    padding: 0;
    margin: 0;
}
#body{
    width: 750px;
    height: 100px;
    line-height: 120px;
    background-color: #FFFFFF;
    position: absolute;
    right: 400px;
}
a{
    text-decoration: none;
    padding-left: 25px;
    color: #333333;
}

效果图

2.小米上边栏

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>Document</title>
    <link rel="stylesheet" href="小米上边栏.css">
</head>
<body>
    <div id="sel">
        <div class="body">
            <a href="" id="a">小米官网</a><span class="seq">|</span>
            <a href="" id="a">小米商城</a><span class="seq">|</span>
            <a href="" id="a">MIUI</a><span class="seq">|</span>
            <a href="" id="a">loT</a><span class="seq">|</span>
            <a href="" id="a">云服务</a><span class="seq">|</span>
            <a href="" id="a">天星数科</a><span class="seq">|</span>
            <a href="" id="a">有品</a><span class="seq">|</span>
            <a href="" id="a">小爱开放平台</a><span class="seq">|</span>
            <a href="" id="a">企业团购</a><span class="seq">|</span>
            <a href="" id="a">资质证照</a><span class="seq">|</span>
            <a href="" id="a">协议规则</a><span class="seq">|</span>
            <a href="" id="a">下载app</a><span class="seq">|</span>
            <a href="" id="a">SelectLocation</a><span class="seq">|</span>
        </div>
        <div class="head">
            <a href="" id="b">登录</a><span class="seq">|</span>
            <a href="" id="b">注册</a><span class="seq">|</span>
            <a href="" id="b">消息通知</a><span class="seq">|</span>
        </div>
    </div>
</body>
</html>

 css部分

*{
    padding: 0;
    margin: 0;
}
#sel{
    height: 40px;
    width: 1200px;
    background-color: #333333;

}
.body{
    width: 900px;
    height: 40px;
    background-color: #333333;
    display: inline-block;
    line-height: 40px;
    margin-left: 50px;
}
.head{
    display: inline-block;
    width: 150px;
    height: 40px;
    background-color: #333333;
    line-height: 40px;
    float: right;
}
a{
    color: #B0B0B0;
    font-size: 12px;
    text-decoration: none;
}
.seq{
    padding-left: 5px;
    padding-right: 5px;
    font-weight: 100;
    color: #424242;
}






 

 效果图

3.小米侧边栏

 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>Document</title>
    <link rel="stylesheet" href="侧边栏.css">
</head>

<body>
    <div id="body"><a href="">手机</a>
        <a href="">电视</a>
        <a href="">笔记本 平板</a>
        <a href="">出行 穿戴</a>
        <a href="">耳机 音箱</a>
        <a href="">家电</a>
        <a href="">智能 路由器</a>
        <a href="">电源 配件</a>
        <a href="">健康 儿童</a>
        <a href="">生活 箱包</a>
    </div>
</body>

</html>

css部分 

* {
    padding: 0;
    margin: 0;
}

#body {
    width: 234px;
    height: 460px;
    background-color: #3F3D3D;
    padding: 25px 0px;
}

#body a {
    line-height: 42px;
    display: block;
    width: 204px;
    height: 42px;
    color: white;
    text-decoration: none;
    padding-left: 30px;
    font-size: 14px;
}

a:hover {
    background-color: #FF6700;
}

 效果图

4.小米手机栏 

 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>Document</title>
    <link rel="stylesheet" href="小米手机栏.css">
</head>
<body>
    <div id="title"> 
        <h2>手机</h2> 
    </div>
    <div id="left">
        <a href="" id="l"><img src="5.jpg" alt="" height="520px" width="200px"></a>
    </div> 
    <div id="right">
        <div>
            <a href="" id="m">
                <img src="7.jpg" alt="" id="a">
                <h3>Xiaomi 12S Ultra</h3>
                <p id="ms">这真徕卡|专业徕卡影像</p>
                <p><span id="n">5999元起</span></p>
            </a>
            <a href="" id="m">
                <img src="6.jpg" alt="" id="b">
                <h3>Xiaomi 12S Pro</h3>
                <p id="ms">骁龙8+ 旗舰处理器|徕卡影像</p>
                <p><span id="n">4699元起</span></p>
            </a>
            <a href="" id="m">
                <img src="9.jpg" alt="" id="c">
                <h3>Xioami 12S</h3>
                <p id="ms">小尺寸性能旗舰|徕卡影像</p>
                <p><span id="n">3999元起</span></p>
            </a>
            <a href="" id="m">
                <img src="1.jpg" alt="" id="d">
                <h3>Xiaomi 12 Pro 天玑版</h3>
                <p id="ms">全球首发天玑9000+ | 叶脉冷泵散热系</p>
                <p><span id="n">3999元起</span></p>
            </a>
            <a href="" id="m">
                <img src="2.jpg" alt="" id="e">
                <h3>Redmi Note 11T Pro+</h3>
                <p id="ms">天玑8100+|真旗舰芯</p>
                <p><span id="n">1999元起</span><span id="v">2099元</span></p>
            </a>
            <a href="" id="m">
                <img src="4.jpg" alt="" id="f">
                <h3>Redmi Note 11T Pro</h3>
                <p id="ms">天玑8100+|真旗舰芯</p>
                <p><span id="n">1699元起</span><span id="v">1799元</span></p>
            </a>
            <a href="" id="m">
                <img src="3.jpg" alt="" id="g">
                <h3>Redmi Note 11SE</h3>
                <p id="ms">双卡双5G|疾速登陆</p>
                <p><span id="n">999元起</span><span id="v">1099元</span></p>
            </a>
            <a href="" id="m">
                <img src="8.jpg" alt="" id="h">
                <h3>Xiaomi Civi 1S</h3>
                <p id="ms">原生美肌人像|奇迹阳光动人新色</p>
                <p><span id="n">2999元起</span></p>
            </a>
        </div>
</body>
</html>

 css部分

*{
    padding: 0;
    margin: 0;
}
#left{
    display: inline-block;
    height: 450px;
    width: 200px;
    float: left;
    margin-top: 20px;
}
#l{
    /* float: left; */
    /* padding-top: 20px; */
}
#a{
    width: 119px;
    height: 159px;
}
#v{
    text-decoration: line-through;
   color: #B0B0B0;
   padding-left: 0px;
}
#m{
    display: inline-block;
    width: 205px;
    height: 230px;
    text-decoration: none;
    padding-top: 20px;
    padding-bottom: 20px;
    float: left;
}
#right{
    width: 820px;
    height: 300px;
    text-align: center;
    float: left;
}
h3{
    color: #333333;
    font-size: 14px;
    font-weight: 400;
    padding-top: 10px;
}
#ms{
    color: #B0B0B0;
    font-size: 12px;
    padding-top: 5px;
}
#n{
    color: #FF6700;
    font-size: 14px;
    display: inline-block;
    padding: 15px 10px 0px 10px;
}

效果图 

这些就是仅用html和css所做的一些案例,对空间的布局,对元素的理解.....

 

 

  • 2
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值