盒子模型内边距padding

1.padding属性用于设置内边距,即边框与内容之间的距离

2.代码:

<!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>
          div{
              width:  200px;
              height: 200px;
              background-color: pink;
              /* 距离左侧边距20px */
              padding-left: 20px;
             /* 距离上边距30px */
              padding-top: 30px;
          }
    </style>
</head>

<body>
      <div>
             盒子内容是content 盒子内容是content 盒子内容是content 盒子内容是content
      </div>    
</body>

</html>

3.运行效果:

猜你喜欢

转载自blog.csdn.net/weixin_42900834/article/details/123239502