CSS综合案例——网页常见布局1

常见网页布局之一如下:
CSS综合案例——网页常见布局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>常见网页布局title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        li {
            list-style: none;
        }
        
        .top {
            height: 50px;
            background-color: gray;
        }
        
        .banner {
            width: 980px;
            height: 150px;
            background-color: gray;
            margin: 10px auto;
        }
        
        .box {
            width: 980px;
            height: 300px;
            margin: 0 auto;
            background-color: pink;
        }
        
        .box li {
            float: left;
            width: 237px;
            height: 300px;
            background-color: gray;
            margin-right: 10px;
        }
        
        .box .last {
            margin-right: 0;
        }
        
        .footer {
            height: 200px;
            background-color: gray;
            margin-top: 10px;
        }
    style>
head>

<body>
    <div class="top">topdiv>
    <div class="banner">bannerdiv>
    <div class="box">
        <ul>
            <li>1li>
            <li>2li>
            <li>3li>
            <li class="last">4li>
        ul>
    div>
    <div class="footer">footerdiv>
body>

html>

你可能感兴趣的:(CSS综合案例,css,css3,html)