gpt4 book ai didi

css - Firefox 和 Chrome/IE 之间的显示差异

转载 作者:行者123 更新时间:2023-11-28 08:52:54 24 4
gpt4 key购买 nike

与 Chome 和 IE 相比,我无法理解为什么 HTML 元素在 Firefox 中显示在不同的位置。我正在使用 position:absolute 将标题和副标题文本放在我希望它们所在的标题中,但 FF 和 Chrome/IE 之间文本元素的水平位置似乎有大约 30px 的差异

HTML 很简单,看起来像这样:

<div id="mainPage">
<div id="mainContent" class="mainRounded">
<div id="header">
<div id="title"><h1>Longer Title Text</h1></div>
<div id="subtitle"><h2>Subtitle text</h2></div>
<div id="banner"></div>
</div>
</div>
</div>

CSS 是这样的:

.mainRounded {
margin: 0 auto;
width: 1000px;
border-radius: 30px;
background-color:#e9d7dc;
box-shadow: 5px 5px 3px #888888;
overflow:hidden;
margin-bottom: 25px;
}
#header #banner {
background-color: #0033CC;
height: 150px;
opacity:0.4;
filter:alpha(opacity=40); /* For IE8 and earlier */
position: relative;
overflow:hidden;
border-radius: 30px 30px 0 0;
}
#header #title {
padding: 0 ;
position: absolute;
top: -40px;
left: 710px;
}
#header #subtitle {
padding: 0 ;
position: absolute;
top: 95px;
left: 870px;
}
#header #title h1 {
font-family: Georgia;
font-size: 54px;
font-style: italic;
font-weight: normal;
text-shadow: 2px 2px 5px #0033CC;
}
#header #subtitle h2 {
font-family: Georgia;
font-size: 26px;
font-style: italic;
font-weight: normal;
}

您可以在此处的测试页面上原地查看:http://mardona.org/test.php老实说,我不明白有什么区别,所以我们将不胜感激。

最佳答案

你应该把position: relative;赋给.mainRounded,然后在margin-top的其他positioned值中将top的margin值改成0,那么它必须随心所欲地工作。

关于css - Firefox 和 Chrome/IE 之间的显示差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15513075/

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