美文网首页
css中的margin

css中的margin

作者: huhu502 | 来源:发表于2016-09-02 21:39 被阅读8次
  • 1)设置盒子与盒子之间的距离
    margin-bottom: 10px;
  • 2)特点
    -->当两个盒子垂直显示的时候(水平方向没有这效果),两个盒子的外边距与最大的为准。
  .one,.two{
        width: 300px;
        height: 300px;
        background-color: pink;
    }
    .one{
        margin-bottom: 180px;
    }
    .two{
        margin-top: 200px;
        background-color: green;
    }
    </style>
   </head>
  <body>
    <div class="one">   
    </div>
    <div class="two"></div>
  </body>
  • 3)margin的属性连写和padding一样
  • 4)水平居中,并且上下外边距都为20px
    margin: 20px auto;
  • 5)ul取消那个小黑点
         ul{
            list-style: none;
        }

相关文章

网友评论

      本文标题:css中的margin

      本文链接:https://www.haomeiwen.com/subject/bnhhettx.html