结束标记格式会导致问题 [英] Ending Tag Format Causes Problem

查看:56
本文介绍了结束标记格式会导致问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我不确定这是HTML问题还是CSS问题,但这很奇怪。


我已经使用XML工作了5年以上,而且你总是这样,你可以使用简短的符号表示这样的空元素:


"< fred />"与< fred>< / fred>"

相同嗯,我看到的情况并非如此。如果你愿意,可以看看

以下两个例子:

< div class =''separatorBar''>< / div>< p>你好< / p>

< hr />

< div class =''separatorBar''/>< p> hello< / p>

< hr />

这些应该是等价的,对吗?看来他们不是。 Firefox

v1.0.4以两种不同的方式呈现两者,IE 6和Opera也是如此。


这里是''separatorBar''的定义:


< style type =''text / css''>

div.separatorBar {

margin-left:-10px;

margin-right:-10px;

border:solid;

}

< / style>

我在这里错过了什么?我虽然< xxx />符号是< xxx>< / xxx>的缩写

。这不是真的>有没有人对我上面的例子有什么解释?


谢谢。


-

Tony LaPaso

解决方案

2005年5月13日星期五,Tony LaPaso写道:

我不确定这是HTML问题还是CSS问题,但这很奇怪。




我不喜欢我们这么认为。看来你没有按照XHTML / 1.0规范的附录

C来表示,这就是全部。什么都不怪异关于

那个。


" Tony LaPaso" < TL ***** @ comcast.net>写道:

我不确定这是HTML问题还是CSS问题,但这很奇怪。


这基本上是一个HTML问题; f''ups相应地设置。

我已经使用XML工作了5年以上,而且你总是可以使用速记符号表示空像这样的元素:

"< fred />"与< fred>< / fred>相同


这一直都是真的,HTML格式化的HTML格式仍然是真的,称为XHTML,这就是你真正的试图使用
,还没有为Web使用做好准备。至少在没有预防措施的情况下,不要吝啬IE&通过应用附录C将它视为旧的HTML。


(如果您不知道附录C的含义,您还没有付款
当你读过ciwah或者你的XHTML引物时你会注意到
- 或者你是/ b $ b发现了一个非常糟糕的引物。)

< div class =''separatorBar '' >< / DIV>< p为H.你好< / p为H.
< HR />
< DIV类= '' separatorBar ''/>< p为H.你好< ; / p>
< hr />

这些应该是等价的,对吗?




它们与XML相同规格。相同的规范告诉

你不应该使用自我关闭。标签除了具有EMPTY的元素

声明的内容,当互操作性时重要的是,在网上它肯定会是b $ b。参考:
http:// www。 w3.org/TR/REC-xml/#sec-starttags

另一方面,空div元素几乎总是
$的症状b $ b糟糕的设计,类名实际证实了这一点。


-

Yucca, http://www.cs.tut.fi/~jkorpela/

好的,好的......我改变了< div class =''separatorBar''/>到< div

class =''separatorBar''/>但行为没有变化。这个问题

关于/>之前的空格。是一个1999年的问题。我不敢相信最新版本的Firefox需要这个空间。更重要的是,* IE和

Firefox的呈现方式不同,取决于我是否使用< ... />

vs.< ...>< /...& GT ;.两种浏览器在这方面都是一致的。


像往常一样,我应该更明确。我正在使用(试图使用)

XHTML 1.0 Strict。这是我正在使用的DTD:<!DOCTYPE html PUBLIC

" - // W3C // DTD XHTML 1.0 Strict // EN" " DTD / XHTML1-strict.dtd">


我不是使用XML序言所以IE 6不"怪异模式" ;.


实际上,忘掉IE 6 - 它从

标准的角度来看已经过时了。我很担心Firefox的呈现方式是什么?
。 Firefox似乎一般都符合标准。


所以,我仍然得到相同的行为。是否有特别的东西

附录C我不见了?


BTW,什么是f''ups和c.i.w.a.h是什么意思?


-

Tony LaPaso

" Jukka K. Korpela" < JK ****** @ cs.tut.fi>在消息中写道

新闻:Xn *************************** @ 193.229.0.31 ...

" Tony LaPaso" < TL ***** @ comcast.net>写道:

我不确定这是一个HTML问题还是CSS问题,但这很奇怪。



它'基本上是一个HTML问题; f''ups相应地设置。

我已经使用XML工作了5年以上,而且你总是可以使用速记这样一个空元素的表示法:

"< fred />"与<< fred>< / fred>"

相同


















HTML版本,称为XHTML,这是您真正尝试使用的,尚未准备好供Web使用。至少在没有预防措施愚弄IE&通过应用附录C,将它视为旧的HTML。

(如果您不知道附录C的含义,那么当您'时,您还没有注意到它们的注意力。读过ciwah或者XHTML底漆 - 或者你
发现了非常差的引物)
< DIV类=' 'separatorBar''>< / DIV> ;< p为H.你好< / p为H.
< HR />
< DIV类= '' separatorBar ''/>< p为H.你好< / p为H.
< hr />

这些应该是等价的,对吗?



它们与XML规范等效。相同的规范
告诉你不应该使用自我关闭。标签除了具有EMPTY
声明内容的元素,当互操作性时它确实很重要,而且在网络上也是如此。参考:
http:// www。 w3.org/TR/REC-xml/#sec-starttags

另一方面,空div元素几乎总是设计糟糕的症状,类名实际证实了这一点。

-
Yucca, http://www.cs.tut.fi/~jkorpela/



Hi all,

I''m not sure if this is an HTML issue or CSS issue but it''s weird.

I''ve been working w/XML for 5+ years and it''s always been true that you
can use a shorthand notation for an empty element like this:

"<fred/>" is the same as "<fred></fred>"
Well, I''m seeing a case where this is not true. Take a look at the
following two examples, if you would:
<div class=''separatorBar''></div><p>hello</p>
<hr/>
<div class=''separatorBar''/><p>hello</p>
<hr/>
These should be equivalent, right? It seems they are not. Firefox
v1.0.4 renders the two differently, as do IE 6 and Opera.

Here is the ''separatorBar'' definition:

<style type=''text/css''>
div.separatorBar {
margin-left:-10px;
margin-right: -10px;
border:solid;
}
</style>
What have I missed here? I though the <xxx/> notation was a shorthand
for <xxx></xxx>. Is this not true> Does anyone have an explanation for
my examples above?

Thanks.

--
Tony LaPaso


解决方案

On Fri, 13 May 2005, Tony LaPaso wrote:

I''m not sure if this is an HTML issue or CSS issue but it''s weird.



I don''t think so. It appears you''re failing to comform with Appendix
C of the XHTML/1.0 specification, that''s all. Nothing "weird" about
that.


"Tony LaPaso" <tl*****@comcast.net> wrote:

I''m not sure if this is an HTML issue or CSS issue but it''s weird.
It''s basically an HTML issue; f''ups set accordingly.
I''ve been working w/XML for 5+ years and it''s always been true that
you can use a shorthand notation for an empty element like this:

"<fred/>" is the same as "<fred></fred>"
It''s been true all the time and it still is true that the XMLized
version of HTML, called XHTML, which is what you are really trying to
use, is not ready for Web use. At least not without the precaution of
fooling IE & Co. into seeing it as old HTML, by applying Appendix C.

(If you don''t know what Appendix C means, you haven''t been paying
attention when you''ve read c.i.w.a.h. or your XHTML primer - or you
found a very poor primer.)
<div class=''separatorBar''></div><p>hello</p>
<hr/>
<div class=''separatorBar''/><p>hello</p>
<hr/>

These should be equivalent, right?



They are equivalent by XML specification. The same specification tells
you should not use "self-closing" tags except for elements with EMPTY
declared content, when "interoperability" matters, and on the Web it
surely does. Ref.:
http://www.w3.org/TR/REC-xml/#sec-starttags

On the other hand, an empty div element is almost always a symptom of
bad design, and the class name virtually confirms this.

--
Yucca, http://www.cs.tut.fi/~jkorpela/


Okay, okay...I changed <div class=''separatorBar''/> to <div
class=''separatorBar'' /> but there''s no change in behavior. This issue
about a space before the "/>" is a 1999 issue. I can''t believe the
latest version of Firefox needs that space. What''s more, *both* IE and
Firefox are rendering differently based on whether or not I use <.../>
vs. <...></...>. Both browsers are consistent in this respect.

As usual, I should have been more explicit. I''m using (trying to use)
XHTML 1.0 Strict. Here''s the DTD I''m using: <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">

I''m not using the xml prolog so IE 6 is not in "quirks mode".

Actually, forget about IE 6 -- it''s hopelessly out of date from a
standards perspective. I am concerned about the way Firefox is
rendering it. Firefox seems to generally be pretty standards compliant.

So, still I get the same behavior. Is there something special in
Appendix C I''m missing?

BTW, what is "f''ups" and "c.i.w.a.h" mean?

--
Tony LaPaso
"Jukka K. Korpela" <jk******@cs.tut.fi> wrote in message
news:Xn***************************@193.229.0.31...

"Tony LaPaso" <tl*****@comcast.net> wrote:

I''m not sure if this is an HTML issue or CSS issue but it''s weird.



It''s basically an HTML issue; f''ups set accordingly.

I''ve been working w/XML for 5+ years and it''s always been true that
you can use a shorthand notation for an empty element like this:

"<fred/>" is the same as "<fred></fred>"



It''s been true all the time and it still is true that the XMLized
version of HTML, called XHTML, which is what you are really trying to
use, is not ready for Web use. At least not without the precaution of
fooling IE & Co. into seeing it as old HTML, by applying Appendix C.

(If you don''t know what Appendix C means, you haven''t been paying
attention when you''ve read c.i.w.a.h. or your XHTML primer - or you
found a very poor primer.)

<div class=''separatorBar''></div><p>hello</p>
<hr/>
<div class=''separatorBar''/><p>hello</p>
<hr/>

These should be equivalent, right?



They are equivalent by XML specification. The same specification
tells
you should not use "self-closing" tags except for elements with EMPTY
declared content, when "interoperability" matters, and on the Web it
surely does. Ref.:
http://www.w3.org/TR/REC-xml/#sec-starttags

On the other hand, an empty div element is almost always a symptom of
bad design, and the class name virtually confirms this.

--
Yucca, http://www.cs.tut.fi/~jkorpela/



这篇关于结束标记格式会导致问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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