[转]position:relative leaves an empty space

王朝学院·作者佚名  2016-05-24  
宽屏版  字体: 小 | 中 | 大 | 超大  

[转]position:relative leaves an empty space本文转自: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:100pxtop:-200px;margin-bottom:-200px;

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

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
© 2005- 王朝网络 版权所有