美文网首页
margin为负值的规则

margin为负值的规则

作者: xingyakong | 来源:发表于2017-02-16 11:49 被阅读0次

    元素的margin为负值时有一些特定的规则:

    • A negative margin to the left or top will pull the element in that direction,
      overlapping any elements next to it.
    • A negative right or bottom margin will pull in any adjacent elements so that they
      overlap the element with the negative margin.
    • On a floated element, a negative margin opposite the float direction will decrease
      the float area, causing adjacent elements to overlap the floated element. A negative
      margin in the direction of the float will pull the floated element in that direction.
    • Finally, the behavior of negative margins to the sides is slightly moderated when
      used on a nonfloating element without a defined width. In that case, negative
      margins to the left and right sides both pull the element in that direction. This
      expands the element, potentially overlapping any adjacent elements.

    相关文章

      网友评论

          本文标题:margin为负值的规则

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