[转]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:100px

top:-200px;

margin-bottom:-200px;

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

 


分享给朋友:
您可能感兴趣的文章:
随机阅读: