开发者

When I use css-position relative, how do I make it so that the elements original position does not block other floated elemnts position?

what the title says开发者_Go百科 ;)

the place where the item used to be is now a void.


Well, position: relative is for moving elements without disturbing everying around. If you want to remove an element from the flow completely, use either position: absolute or float: left/right. If you want to move the element, but let other elements occupy the freed space, use negative margins.

You can even combine all three! For example, to have an element removed from the flow but positioned relatively to its original position, use position:absolute with no top/left/right/bottom, but move it with negative margins instead. Warning: inline and block elements will behave differently with that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜