gpt4 book ai didi

css - 负边距在 IE 7 中不起作用

转载 作者:行者123 更新时间:2023-11-28 11:13:16 25 4
gpt4 key购买 nike

我有以下代码:

 <style>
.earthlogo{float: right; margin: -270px 0px 0px 0px;}
</style>

<div class="banner">
<p>ENVISIONING A BETTER TOMORROW</p>
<div class="earthlogo">
<img src="images/earth.png"/>
</div>
</div>

在这里,我将负边距应用到类 earthlogo 及其在 firefox 和 google chrome 中的工作,但在 IE 7 中不起作用。那么这是在 CSS 中应用负边距的正确方法吗,如果它是正确的那么为什么它在 IE 7 中不起作用。我该如何解决 IE 问题。

谢谢

最佳答案

您可以使用 position: relative; 以及负 topleft 偏移量来代替负 margins ;

.earthlogo {
position: relative;
top: -270px; /*pull it 270 pixels up*/
left: 0px; /*we don't want to pull it to the left*/
margin: 0px; /*make sure no margins are applied*/
}

关于css - 负边距在 IE 7 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12638105/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com