CSS第四天-浮动

<!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>
        /* CSS书写顺序 浏览器执行效率更高
        1.浮动/display
        2.盒子模型 margin border padding 宽高背景色
        3.文字样式

        */
        /* div {
            margin: 90px auto;
            background-color: pink;
            width: 400px;
            height: 400px;
            box-sizing: border-box;
        } */

        ul {
            /* padding: 50px 80px;
            width: 100px;
            height: 100px; */
            /* margin: 0 auto; */

        }

        /* li {
            list-style: none;

            padding: 10px;

            color: rgb(255, 0, 149);

        } */

        /* 选中奇数 */
        /* li:nth-child(2n-1) {
            background-color: darkorchid;
        } */
        /* 选中第一个li的第二个a */
        li:first-child a:nth-child(2) {
            color: red;
        }

        /* 伪元素默认行内元素*/
        /* .father::before {
            content: '帅';
            display: block;
            width: 100px;
            height: 100px;
            background-color: blue;
        }

        .father::after {
            content: '逼人';

        }

        /* 浮动 可以使块标签排列在一行且中间没有空格*/
        /* .one {
            width: 100px;
            height: 100px;
            background-color: aqua;
            float: left;
        } */

        /* 浮动  maigin 无法生效*/
        /* .two {
            width: 200px;
            height: 200px;
            background-color: blue;
            float: left;
        } */

        /* .three {
            width: 300px;
            height: 300px;
            background-color: pink;
            float: left;
        } */

        * {
            margin: 0;
            padding: 0;
        }

        .top {
            height: 40px;
            background-color: #333;
        }

        .head {
            width: 1226px;
            height: 100px;
            background-color: #ffc0cb;
            margin: 0 auto;
        }

        /* 大盒子 放里面两个小盒子标签 */
        .fathe {
            margin: 0 auto;
            width: 1226px;
            height: 460px;
            background-color: blue;
        }

        /* 设置宽度以免下面的盒子放不下 */
        .bood {
            float: left;
            width: 234px;
            height: 460px;
            background-color: #ffa500;
        }

        .base {
            width: 992px;
            height: 460px;
            background-color: #87ceeb;
            float: left;

        }
    </style>
</head>

<body>
    <!-- <div>
        <ul>

            <li>
                <a href="#">111</a>
                <a href="#">111</a>
                <a href="#">111</a>
            </li>
            <li>这是第2个li</li>
            <li>这是第3个li</li>
            <li>这是第4个li</li>
            <li>这是第5个li</li>
            <li>这是第6个li</li>
            <li>这是第7个li</li>
            <li>这是第8个li</li>
            <div class="father">气</div>
        </ul>
        <div class="one"></div>
        <div class="two"></div>
        <div class="three"></div>
    </div> -->
    <div class="top"></div>
    <div class="head"></div>
    <div class="fathe">
        <div class="bood"></div>
        <div class="base"></div>
    </div>

</body>

</html>

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值