美文网首页
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为负值的规则

    元素的margin为负值时有一些特定的规则: A negative margin to the left or t...

  • css杂项

    bo一、margin负值 margin-left / margin-top为负值,当前元素会向左 / 上拖动 ...

  • 前端记录20171208

    margin 设置为负值,元素将会变大

  • css 负边距

    可以通过负值的margin来抵消掉padding的影响 1.margin:负值 当给一个元素设置margin 负值...

  • margin为负值的拓展

    css中的负边距(negative margin)是布局中的一个常用技巧,只要运用得合理常常会有意想不到的效果。很...

  • margin为负值的分析

    引子 解决一个问题的关键在于马上着手去解决这个问题。我们都觉得CSS难学,那么就抓紧时间去学,去学,去学 marg...

  • margin负值

    margin-left和margin-right负值会增加元素的宽度(当元素不存在width属性或者width属性...

  • margin负值的应用

    边框重叠 两个盒子的边框叠加,使得边框变粗,使用margin负值可解决 hover缺失 使用上面的margin负值...

  • 新建margin负值

    1.margin先接触,然后是border,然后是padding,然后是content2.值为负值,将不再占据空间...

  • 4.CSS布局篇之margin负值问题

    margin-top和margin-left负值,元素向上、向左移动 margin-right和margin-bo...

网友评论

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

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