首页 > 其他 > 详细

[转]position:relative leaves an empty space

时间:2014-01-27 16:46:32      阅读:326      评论:0      收藏:0      [点我收藏+]

本文转自:http://stackoverflow.com/questions/5229081/positionrelative-leaves-an-empty-space

在使用relative进行定位时

比如一个设置了width的td内 包含select 和 input

将input通过position:relative ; top:-23px 进行位置上移  覆盖了select的部分区域

但td的高度 却还是两个控件的高度

可以通过margin-bottom的设置 来使其空白不占高度

 

Another trick which worked fine for me is to use a negative margin-bottom in the relative element that you have moved. No need to go with absolute positioning.

Something like:

position: relative;
left:100px
top:-200px;
margin-bottom:-200px;

Similar (if not identical) to the solution I see now, from green.

[转]position:relative leaves an empty space

原文:http://www.cnblogs.com/freeliver54/p/3534637.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!