css基础练习--浮动布局小demo--小米商城布局-新闻导航--源码

1.简单

在这里插入图片描述

<!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>
 <style>
     .a1{
         background-color: pink;
         width: 1240px;
         height: 50px;

     }
     .a2{
         float: left;
         width: 240px;
         height: 300px;
         background-color:yellow;
     }
         .a3{
             float: left;
             width: 1000px;
             height: 300px;
             background-color:skyblue;
         }
 </style>
</head>
<body>
    <div class="a1"></div>
    <div class="a2"></div>
    <div class="a3"></div>
</body>
</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>
</head>
<style>
    .a1{
        float: left;
        width: 192px;
        height: 614px;
        background-color: purple;
    }
    .b1
    {
        float: left;
        width: 992px;
        height: 614px;
        background-color: pink;
    }
    ul{

    margin:0px;
    padding:0px;
}
li{
    float:left;
    list-style:none;
    /* list-style: none; */
    /* float: left; */
    width: 234px;
    height: 300px;
    background-color:skyblue;
    margin-left: 14px;
    margin-bottom: 14px;
}
</style>
<body>
    <div class="a1"></div>
    <div class="b1">
        <ul class="b11">
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
            <li></li>
        </ul>
    </div>
</body>
</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>
</head>
<style>
    nav{
        width: 640px;
        height: 50px;
    }
    ul{
        margin: 0px;
        padding:0px;
        /* ul有自己默认的margin和padding需要先去除 */
    }
    li{
        float: left;
        list-style: none;
        /* 去除li左侧的小黑点 */
        width: 80px;
        height: 50px;
        background-color: pink;
        font-size: 16;
        /* color: #fff; */
        text-align: center;
        line-height: 50px;
    }
    a{
        text-decoration: none;
        color: #fff;
    }
    li:hover{
        background-color: green;
    }
</style>
<body>
<div class="nav">
    <ul>
        <a href="#"></a>
        <li>  <a href="#">新闻1</a></li>
        <li>  <a href="#">新闻2</a></li>
        <li>  <a href="#">新闻3</a></li>
        <li>  <a href="#">新闻4</a></li>
        <li>  <a href="#">新闻5</a></li>
        <li>  <a href="#">新闻6</a></li>
        <li>  <a href="#">新闻7</a></li>
        <li>  <a href="#">新闻8</a></li>
    </ul>
</div>    
</body>
</html>
  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

临夏_

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值