Getting web front-end to combat: padding property, property margins

An inner margin properties

1. Definitions: the distance between the border and the content is within the margin

2. Write apart

padding-top:数字px;

padding-left:数字px;

padding-bottom:数字px;

padding-right:数字px;

3. ligatures:

padding:上 右 下 左;

4. Notes:

After padding (1) is provided to the tag, label width and height occupied vary

(2) there will be a background color padding

web前端开发学习Q-q-u-n: ⑦⑧④-⑦⑧③-零①②,分享学习的方法和需要注意的小细节,不停更新最新的教程和学习方法(详细的前端项目实战教学视频)
<style>

    div{

        font-size: 25px;

        width:100px;

        height: 100px;

        border: 1px solid red;

        background-color: green;

    }

    .box1{

        padding-top:20px;

    }

    .box2{

        padding-left: 30px;

    }

    .box3{

        padding-bottom: 40px;

    }

    .box4{

        padding-right:50px;

    }

    .box5{

        padding:40px 60px 70px 80px;

    }

</style>

<body>

<div class="box1">我是段落一</div>

<div class="box2">我是段落二</div>

<div class="box3">我是段落三</div>

<div class="box4">我是段落四</div>

<div class="box5">我是段落五</div>

</body>

Getting web front-end to combat: padding property, property margins

Second, the margins Properties

1. Definitions: the distance between the tag and the tag is Margin

2. Separate wrote:

margin-top:数值px;

margin-left:数值px;

margin-bottom:数值px;

margin-left:数值px;

3. Write together

margin:上 左 下 右;

4. Examples

web前端开发学习Q-q-u-n: ⑦⑧④-⑦⑧③-零①②,分享学习的方法和需要注意的小细节,不停更新最新的教程和学习方法(详细的前端项目实战教学视频)
    <style>

        span{

            width: 100px;

            height:100px;

            background-color: red;

            margin:50px;

            border:2px solid black;

        }

        .box1{

            margin-top:20px;

        }

        .box2{

            margin-left:30px;

        }

        .box3{

            margin-bottom: 40px;

        }

        .box4{

            margin-rigth:50px;

        }

        .box5{

            margin:60px 70px 80px 90px;

        }

</style>

</head>

<body>

<span class="box1">我是span</span><span class="box2">我是span</span><span class="box3">我是span</span><span class="box4">我是span</span><span class="box5">我是span</span>

Getting web front-end to combat: padding property, property margins

5. Note point: margins that are not part of the background color.

Guess you like

Origin blog.51cto.com/14592820/2460647