IE6 - 背景图像丢失,标题中有多余像素,大多数内容偏离中心

发布于 2024-07-27 16:56:51 字数 527 浏览 4 评论 0原文

我的 WordPress 网站在 IE6 中正确显示时遇到重大问题。

链接到下面的屏幕截图。 我的背景图像丢失了,导航被减少了一些额外的像素,而且我的大部分内容都偏离了中心。

www.genevarealtytrust.com/content/wp-content/themes/wp-terra-basic/images/ie6_wpterra.jpg

FF 屏幕截图(链接如下)就是它应该的样子。 已经在 Safari、几个版本的 Firefox 和 IE7 中尝试过,所有的看起来都与预期的一样。 IE6 是唯一给我带来麻烦的。

www.genevarealtytrust.com/content/wp-content/themes/wp-terra-basic/images/ff_wpterra.jpg

有什么想法吗?

链接:www.genevarealtytrust.com/content

我已经验证了我的代码,并尝试了一些方法,但没有成功。

帮助! 欣赏它!

Having major issues getting my wordpress website to display correctly in IE6.

Link to screenshot below. My background image is missing, the nav is knocked down a few extra pixels, and most of my content is off center.

www.genevarealtytrust.com/content/wp-content/themes/wp-terra-basic/images/ie6_wpterra.jpg

FF screenshot (linked below) is what it should look like. Have tried in Safari, a couple versions of Firefox, and IE7, and all look just the way that they are supposed to. IE6 is the only one giving me trouble.

www.genevarealtytrust.com/content/wp-content/themes/wp-terra-basic/images/ff_wpterra.jpg

Any ideas??

Link: www.genevarealtytrust.com/content

I've validated my code, and have tried a few things, but no success.

Help! Appreciate it!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

殤城〤 2024-08-03 16:56:51

您可以尝试使用条件样式。 在文档的 head 部分粘贴:

<!--[if lte IE 6]>
<link rel="stylesheet" media="screen,projection" href=www.example.com/ie.css" type="text/css" />
<![endif]-->

现在您可以开始编辑 ie.css,而不必担心破坏其他浏览器的设计。

导航周围的额外空间:IE 有时具有与其他浏览器不同的默认边距/填充。 尝试

#something {
margin: 0; 
padding: 0;
}

在新的 css 中显式定义。

没有背景:也许是对齐的原因。 尝试在背景图像定义中添加“左上角”之类的内容。 示例:

background-image: url('../img/site-bg.jpg') no-repeat scroll top right;

内容居中:在 CSS 中,有两种方法可以使内容居中。 第一:设置父元素text-align属性为center;。 第二:定义宽度并将边距设置为top-bottom-margin-value auto;。 示例:

#something {
 width: 100px;
 margin: 10px auto;
}

我希望这将有助于解决您的任何问题:)

You can try using conditional styles. In document's head section paste:

<!--[if lte IE 6]>
<link rel="stylesheet" media="screen,projection" href=www.example.com/ie.css" type="text/css" />
<![endif]-->

Now You can start editing ie.css without worrying about spoiling design for other browser.

Extra space around nav: IE sometimes has default margins/paddings different from other browsers. Try defining

#something {
margin: 0; 
padding: 0;
}

explicitly in Your new css.

No background: Maybe it's the alignment. Try adding somethig like "top left" to Your background-image definition. Example:

background-image: url('../img/site-bg.jpg') no-repeat scroll top right;

Content centering: In CSS there are two ways to center content. First: setting the parent element text-align property to center;. Second: Defining width and setting margin to top-bottom-margin-value auto;. Example:

#something {
 width: 100px;
 margin: 10px auto;
}

I hope this will help solve any of Your problems :)

看轻我的陪伴 2024-08-03 16:56:51

这并不是您问题的真正答案(因为我没有足够的代表来发表评论:)),但请尝试运行 此列表常见 IE CSS 错误。 它帮助我解决了 CSS 中的一些问题,但 IE 6 是一个战区。 否则,我真的建议您阅读这本精彩的书防弹网页设计

This isn't really an answer to your question (and since I don't have enough rep to comment :) ), but try running through this list of common IE CSS bugs. It's helped me work out some kinks in my CSS, but IE 6 is a warzone. Otherwise, I'd really suggest getting the fantastic book Bulletproof Web Design.

俏︾媚 2024-08-03 16:56:51

谢谢提醒伙计! Daveslab,我一定会把这份清单放在手边,并感谢您推荐这本书。

居中问题/缺少背景图像:

我制作了备用 css 文档,这给了我更多的实验空间 - 我能够通过稍微简化 CSS 来解决有问题的 CSS 缺失和居中问题部分通过反复试验。 (删除了浮动、位置...)

额外像素:

最终修复了标题底部的 3 个像素...真是太愚蠢了。

显然 IE6 在标题图像的底部应用了额外的 3 个像素,因为该 div 的 html 代码被分成 3 行...

<div id="header">
<img src="url" />
</div>

我只需将它们全部组合成一行,底部的额外填充就消失了。 愚蠢...(而且丑陋)

<div id="header"><img src="url" /></div>

我在右侧仍然有一个额外的像素,我正在尝试解决它 - 仍在调查。

Thanks for the tips guys! Daveslab, I'll definitely keep that list handy, and thanks for the book recommendation.

Centering Issue/Missing Background Image:

I made the alternate css doc and that gave me more room to experiment - I was able to resolve the missing background image and centering issue by simplifying the CSS a bit for the problematic section by trial and error. (removed float, position...)

Extra pixels:

What finally ended up fixing the 3 pixels on the bottom of my header was... just stupid.

Evidently IE6 was applying an extra 3 pixels to the bottom of the header image because my html code for that div was split into 3 lines...

<div id="header">
<img src="url" />
</div>

I just had to combine them all into one line, and the extra padding on the bottom disappeared. Dumb... (and ugly)

<div id="header"><img src="url" /></div>

I still have an extra pixel on the right side that I'm trying to resolve - still investigating.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文