1. 主页
  2. 文档
  3. CSS
  4. 盒模型
  5. padding属性详解

padding属性详解

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box1 {
            width: 200px;
            height: 200px;
            padding-top: 10px;
            padding-right: 30px;
            padding-bottom: 50px;
            padding-left: 70px;
            background-color: orange;
        }
        .box2 {
            width: 200px;
            height: 200px;
            background-color: orange;
            padding: 10px 20px 30px 40px;
        }
        .box3 {
            width: 200px;
            height: 200px;
            background-color: orange;
            padding: 10px 20px 30px;
        }
        .box4 {
            width: 200px;
            height: 200px;
            background-color: orange;
            padding: 10px 20px;
        }
        .box5 {
            width: 200px;
            height: 200px;
            background-color: orange;
            padding: 10px;
        }
    </style>
</head>

<body>
    <div class="box1"></div>
    <div class="box2"></div>
    <div class="box3"></div>
    <div class="box4"></div>
    <div class="box5"></div>
</body>

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

我们要如何帮助您?