元素的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.
网友评论