1. 主页
  2. 文档
  3. CSS
  4. 浮动案例解析
  5. 浮动布局1

浮动布局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>
</head>
<style>
    * {
        padding: 0;
        margin: 0;
    }
    
    .header,
    .main,
    .footer {
        background-color: silver;
        width: 1000px;
        margin: 0 auto;
    }
    
    .header {
        height: 100px;
    }
    
    .header .logo {
        width: 200px;
        height: 100px;
        background-color: blueviolet;
        float: left;
    }
    
    .header .tel {
        width: 800px;
        height: 100px;
        background-color: brown;
        float: right;
    }
    
    .header .tel .r1 {
        width: 200px;
        height: 30px;
        background-color: chartreuse;
        float: right;
    }
    
    .header .tel .r2 {
        width: 700px;
        height: 70px;
        background-color: coral;
        float: right;
    }
    
    .main {
        height: 500px;
    }
    
    .main .main_l1 {
        width: 400px;
        height: 500px;
        background-color: crimson;
        float: left;
    }
    
    .main .main_r1 {
        width: 590px;
        height: 500px;
        background-color: darkorange;
        float: right;
    }
    
    .main .main_r1 .main_r1_1 {
        width: 590px;
        height: 400px;
        background-color: darkslategray;
    }
    
    .main .main_r1 .main_r1_2 {
        width: 590px;
        height: 100px;
        background-color: fuchsia;
    }
    
    .main .main_r1 .main_r1_2 ul li {
        list-style: none;
        width: 110px;
        height: 100px;
        background-color: goldenrod;
        float: left;
        margin-left: 5px;
    }
    
    .footer {
        height: 200px;
    }
</style>

<body>
    <div class="header">
        <div class="logo"></div>
        <div class="tel">
            <div class="r1"></div>
            <div class="r2"></div>
        </div>
    </div>
    <div class="main">
        <div class="main_l1"></div>
        <div class="main_r1">
            <div class="main_r1_1"></div>
            <div class="main_r1_2">
                <ul>
                    <li>111</li>
                    <li>222</li>
                    <li>333</li>
                    <li>444</li>
                    <li>555</li>
                </ul>
            </div>
        </div>
    </div>
    <div class="footer"></div>
</body>

</html>
这篇文章对您有用吗?

我们要如何帮助您?