简体   繁体   English

如何在IE7中添加负边距?

[英]How to add negative margin in IE7?

How can I add negative margin in IE7? 如何在IE7中添加负边距? My code is: 我的代码是:

.product-tabs {
    position: relative;
    margin: -40px 0 0 -17px;
}

In all browsers it works like I wan't except in IE7, I tried to replace margin with top:-40px; left:-17px; 在所有浏览器中,除了IE7之外,它都像我一样工作,我尝试将top:-40px; left:-17px;替换为margin top:-40px; left:-17px; top:-40px; left:-17px; but then block moves up and leaves empty space at the bottom. 但随后方块向上移动并在底部留下空白区域。 Also I tried changing position: relative to position: absolute , but then .product-tabs parent div height is 0. 我也尝试更改position: relative对于position: absolute ,但然后.product-tabs父div高度为0。

used to this 习惯了

.product-tabs {
    position: relative;

top:-40px;
left:-17px;bottom:0;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM