?xml Prolog& IE6中的Box模型问题 [英] ?xml Prolog & Box Model Issues in IE6

查看:35
本文介绍了?xml Prolog& IE6中的Box模型问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在部分改造公司网站。我的主要简介

是重新组织了大部分内容并更新了很多副本,但是

在这个过程中我也试图纠正一些技术方面。

网站看起来还不错,但在引擎盖下它是令人厌恶的;它是由一个

营销公司设计的,似乎他们也是网页设计师,因为他们

拥有Dreamweaver的副本。


除此之外,我已经替换了那里的大部分图像

而不是标题(!);我正在使用javascript翻转处理完全由图像(文本)构成的菜单系统。


但是我无法改变它所有在这个阶段,所以我仍然受到原始设计的大部分限制。我已经用预期的

html + css替换了图像翻转。但是,我在IE6下发现了一个小问题(我在IE6,IE7,FF2和Opera9下进行了b
测试);当我展开菜单以显示

子菜单项时,这些项目的背景没有完整的阴影。


我已经提出了页面演示:
http://www.brightnorth。 com / cjm / emx / apps2.html


我认为这是某种Box Model问题,并经过一些

调查我发现它确实是......显然IE6会恢复到IE5的

古怪的盒子模型行为,如果你在XHTML

页面中包含?xml prolog。


所以我从页面中删除了有问题的行(即第一行)并进行了测试。 Et

瞧!它工作正常: http://www.brightnorth.com/cjm/ emx / apps2.html


我已经在一个地方读过这条线是可选的,可以是

忽略;但很多指南表现得好像是强制性的。但我想知道传统智慧所说的b $ b。肯定错过了prolog最好的

期权?或者有理由保留它吗?我不喜欢

插入黑客来补偿的想法。


有什么想法吗?


CJM

解决方案

Scripsit CJM:


显然IE6还原为

如果你在XHTML页面中包含?xml prolog

,IE5的古怪盒子模型行为。



的确如此。 DOCTYPE声明之前的_Anything_导致了这种情况。我不认为

除了懒惰之外还有其他任何解释:编写DOCTYPE

嗅探的人IE中的代码并没有打扰通过第一行查找

DOCTYPE声明。


我已经读过一个无论如何,这条线是可选的,并且可以是忽略;



根据XML规范,它应该在那里,但它不是必需的,如果

中的一个是真的:

a)文档的编码是UTF-8

b)文档的编码是UTF-16(文档以BOM开头)

c)有一个HTTP头指定编码。


对于官方有关指定编码的教程,请参阅
http: //www.w3.org/International/tuto...rial-char-enc/


肯定错过了最好的选择吗?



这是一个简单的,但只有在使用UTF-8时它才真正可行。选项

b,使用UTF-16,在网上不实用,因为

浏览器和搜索引擎支持不佳。依赖c)有点风险,因为

文档可能会以失去

信息的方式保存在本地(例如,由用户)。


-

Jukka K. Korpela(Yucca)
http://www.cs.tut.fi/~jkorpela/



CJM写道:


我正在部分改造公司网站。我的主要简介

是重新组织了大部分内容并更新了很多副本,但是

在这个过程中我也试图纠正一些技术方面。

网站看起来还不错,但在引擎盖下它是令人厌恶的;它是由一个

营销公司设计的,似乎他们也是网页设计师,因为他们

拥有Dreamweaver的副本。


除此之外,我已经替换了那里的大部分图像

而不是标题(!);我正在使用javascript翻转处理完全由图像(文本)构成的菜单系统。


但是我无法改变它所有在这个阶段,所以我仍然受到原始设计的大部分限制。我已经用预期的

html + css替换了图像翻转。但是,我在IE6下发现了一个小问题(我在IE6,IE7,FF2和Opera9下进行了b
测试);当我展开菜单以显示

子菜单项时,这些项目的背景没有完整的阴影。


我已经提出了页面演示:
http://www.brightnorth。 com / cjm / emx / apps2.html


我认为这是某种Box Model问题,并经过一些

调查我发现它确实是......显然IE6会恢复到IE5的

古怪的盒子模型行为,如果你在XHTML

页面中包含?xml prolog。


所以我从页面中删除了有问题的行(即第一行)并进行了测试。 Et

瞧!它工作正常: http://www.brightnorth.com/cjm/ emx / apps2.html


我已经在一个地方读过这条线是可选的,可以是

忽略;但很多指南表现得好像是强制性的。但我想知道传统智慧所说的b $ b。肯定错过了prolog最好的

期权?或者有理由保留它吗?我不喜欢

插入黑客来补偿的想法。


有什么想法吗?


CJM



我倾向于将其遗漏。

虽然,你应该使用严格的Doctype,因为它会保留所有的

浏览器支持超出怪癖模式的XHTML。

哦,你有19个验证错误,你可以把它们修好为




-

问候乍得。 http://freewebdesign.cjb.cc


而且,CJM在

alt中发言。 http://www.webmaster,comp.infosystem...uthoring.html:


I'已经提出了一个页面来证明:
http:/ /www.brightnorth.com/cjm/emx/apps2.html


我认为这是某种Box Model问题,并且经过一段时间的

调查我发现它确实是......显然IE6恢复到IE5的

古怪的盒子模型行为如果你在一个

中包含?xml prolog XHTML

页。


所以我从页面中删除了有问题的行(即第一行)并进行了测试。

Et

瞧!它工作正常: http://www.brightnorth.com/cjm/ emx / apps2.html


我已经在一个地方读过这条线是可选的,可以是

忽略;但很多指南表现得好像是强制性的。但是我想知道

传统智慧所说的。肯定错过了prolog最好的

期权?或者有理由保留它吗?我不喜欢

插入黑客来补偿的想法。


有什么想法吗?



你说你使用的是ISO-8859-1(线程中的其他地方)?在一个

手上,如果你把它放进去,你就会遇到IE6问题,另一方面你已经将b $ b转换为UTF-8和浏览你的网页,确保没有任何编码错误。第三方面,您可以安装一个服务器端

嗅探脚本,尝试添加和删除序言,具体取决于您认为访问的是哪个
浏览器。


哇,真是令人头疼。


坚持使用HTML 4.01,你可以避免所有这些问题。这是没有

脑筋。


灰色


-

技术公理,没有什么是不可能的,这无异于暗示,没有什么是荒谬的。

- http://www.greywyvern.com/orca#search - Orca搜索:全功能

蜘蛛和网站 - 搜索引擎


I''m in the process of partially revamping a corporate website. My main brief
was to reorganise much of the content and to update a lot of the copy, but
in the process I''m also trying to correct some of the technical aspects. The
site looks OK, but under the hood it is an abomination; it was designed by a
marketing company seemed to thing they were also web designers because they
owned a copy of Dreamweaver.

Amongst other things, I''ve replaced most of the images that were there
instead of headers(!); and I''m tackling the menu system that consisted
entirely of images (of text) with javascript rollovers.

But I can''t change it all at this stage, so I''m still constrained by much of
the original design. I''ve replaced the image rollovers with the expected
html+css alternative. However, I''m finding a small problem under IE6 (I''m
testing under IE6, IE7, FF2 & Opera9); when I expand the menu to reveal the
sub-menu items, the background for these items is not full shaded.

I''ve bodged up a page to demonstrate:
http://www.brightnorth.com/cjm/emx/apps2.html

I assumed it was some sort of Box Model issue, and after a bit of
investigation I found that it indeed was... apparently IE6 reverts to the
quirky box model behaviour of IE5 if you include the ?xml prolog in an XHTML
page.

So I remove the offending line (ie the first) from the page and tested. Et
Voila! It works fine: http://www.brightnorth.com/cjm/emx/apps2.html

I''ve read in one place that this line is optional anyway, and can be
ignored; but lots of guides behave as if it compulsary. But I was wondering
what conventional wisdom says. Surely missing the prolog out it the best
options? Or are there reasons to keep it in? I don''t fancy the idea of
inserting hacks to compensate.

Any thoughts?

CJM

解决方案

Scripsit CJM:

apparently IE6 reverts to
the quirky box model behaviour of IE5 if you include the ?xml prolog
in an XHTML page.

Indeed. _Anything_ before the DOCTYPE declaration causes that. I don''t think
there''s any other explanation than lazyness: people who wrote the "DOCTYPE
sniffing" code in IE didn''t bother looking past the first line to find a
DOCTYPE declaration.

I''ve read in one place that this line is optional anyway, and can be
ignored;

By XML specifications, it SHOULD be there, but it is not required, if one of
the following is true:
a) the document''s encoding is UTF-8
b) the document''s encoding is UTF-16 (and the document starts with BOM)
c) there is an HTTP header specifying the encoding.

For an "official" tutorial on specifying the encoding, see
http://www.w3.org/International/tuto...rial-char-enc/

Surely missing the prolog out it the best options?

It''s a simple one, but it''s really feasible only when UTF-8 is used. Option
b, using UTF-16, is not practical on the web, due to poor support in
browsers and search engines. Relying on c) is somewhat risky, since the
document might be saved locally (e.g., by a user) in a manner that loses
information about HTTP headers.

--
Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/



CJM wrote:

I''m in the process of partially revamping a corporate website. My main brief
was to reorganise much of the content and to update a lot of the copy, but
in the process I''m also trying to correct some of the technical aspects. The
site looks OK, but under the hood it is an abomination; it was designed by a
marketing company seemed to thing they were also web designers because they
owned a copy of Dreamweaver.

Amongst other things, I''ve replaced most of the images that were there
instead of headers(!); and I''m tackling the menu system that consisted
entirely of images (of text) with javascript rollovers.

But I can''t change it all at this stage, so I''m still constrained by much of
the original design. I''ve replaced the image rollovers with the expected
html+css alternative. However, I''m finding a small problem under IE6 (I''m
testing under IE6, IE7, FF2 & Opera9); when I expand the menu to reveal the
sub-menu items, the background for these items is not full shaded.

I''ve bodged up a page to demonstrate:
http://www.brightnorth.com/cjm/emx/apps2.html

I assumed it was some sort of Box Model issue, and after a bit of
investigation I found that it indeed was... apparently IE6 reverts to the
quirky box model behaviour of IE5 if you include the ?xml prolog in an XHTML
page.

So I remove the offending line (ie the first) from the page and tested. Et
Voila! It works fine: http://www.brightnorth.com/cjm/emx/apps2.html

I''ve read in one place that this line is optional anyway, and can be
ignored; but lots of guides behave as if it compulsary. But I was wondering
what conventional wisdom says. Surely missing the prolog out it the best
options? Or are there reasons to keep it in? I don''t fancy the idea of
inserting hacks to compensate.

Any thoughts?

CJM

I tend to leave it out.
Although, you should use a Strict Doctype, as it will keep all the
browsers that support XHTML out of quirks mode.
Oh and you have 19 validation errors, you might as well fix those as
well.

--
Regards Chad. http://freewebdesign.cjb.cc


And lo, CJM didst speak in
alt.http://www.webmaster,comp.infosystem...uthoring.html:

I''ve bodged up a page to demonstrate:
http://www.brightnorth.com/cjm/emx/apps2.html

I assumed it was some sort of Box Model issue, and after a bit of
investigation I found that it indeed was... apparently IE6 reverts to the
quirky box model behaviour of IE5 if you include the ?xml prolog in an
XHTML
page.

So I remove the offending line (ie the first) from the page and tested.
Et
Voila! It works fine: http://www.brightnorth.com/cjm/emx/apps2.html

I''ve read in one place that this line is optional anyway, and can be
ignored; but lots of guides behave as if it compulsary. But I was
wondering
what conventional wisdom says. Surely missing the prolog out it the best
options? Or are there reasons to keep it in? I don''t fancy the idea of
inserting hacks to compensate.

Any thoughts?

You say you''re using ISO-8859-1 (elsewhere in the thread)? On the one
hand, you''ve got IE6 problems if you leave it in, on the other hand you''ve
got to switch to UTF-8 and go through your pages making sure there aren''t
any encoding errors. On the third hand, you could rig up a server-side
sniffing script to try adding and removing the prolog depending on which
browser you think is visiting.

Whew, what a headache.

Just stick with HTML 4.01 and you avoid all these issues. It''s a no
brainer.

Grey

--
The technical axiom that nothing is impossible sinisterly implies the
pitfall corollary that nothing is ridiculous.
- http://www.greywyvern.com/orca#search - Orca Search: Full-featured
spider and site-search engine


这篇关于?xml Prolog& IE6中的Box模型问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆