赢在职场-WEB全栈开发-1-7margin

1-7margin 外边距

<!doctype html>

<html>

    <head>

        <title>抬头</title>

        <meta charset="utf-8">

        

        <style>

            .InternalStyle1

            {

                width:300px;

                height:300px;

                background:green center bottom no-repeat url("dragon.png");

                border: purple 30px solid;

                padding-top: 100px;

                margin-bottom: 30px;//外边距

            }

            

            .InternalStyle2

            {

                width:300px;

                height:300px;

                background:orange center bottom no-repeat url("dragon.png");

                border: brown 60px solid;

                padding-top: 100px;

                margin-top: 60px;//外边句会叠加,注意InternalStyle1InternalStyle2放在一起时只有60px(最大)的边距,而不是相加后的90px

                //margin:top right bottom left;//复合写法

                //margin:top/bottom right/left;

            }

        </style>

        

        

        <link href = "main.css" rel = "stylesheet">

    </head>

    <body>

        <div class = "InternalStyle1">Internal Style1 内部样式1</div>

        <div class = "InternalStyle2">Internal Style2 内部样式2</div>

        

        <div class = "InternalStyle2">

            边距传递

            <div class = "InternalStyle1">

                边距传递:父子级包含时,子级的margintop会传递给父级。

            </div>

        </div>

    </body>

</html>



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值