清空有效与否? [英] Empty a valid or not?

查看:81
本文介绍了清空有效与否?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据规格

http://www.w3.org/TR/html401/struct/links.html#h-12.2) ,< a>元素

需要一个结束标记。因此,当我们使用< A NAME =" foo">在HTML 2.0中

4.01,它不会验证,它会想要找到< / A>标签。


然而,当我写一个文件,其中包含< a name =" foo" />它会在XHTML 1.0中验证



我在这里显然遗漏了一些东西,因为这让我感到困惑。

神奇/使空元素有效吗?并且这不违反
http:// www。 w3.org/TR/xhtml1/#C_3


最近我能算出来,它建议虽然标签会是

验证,我们仍然不应该这样做,以防UA无法处理空的

元素。我是在正确的轨道上吗?


如果没有,请随时纠正我。

According to the specs
(http://www.w3.org/TR/html401/struct/links.html#h-12.2), the <a> element
requires an end tag. And so, when we use <A NAME="foo"> in HTML 2.0 to
4.01, it won''t validate, it''ll want to find the </A> tag.

However, when I write a document containing, say, <a name="foo" /> it
validates in XHTML 1.0.

I''m obviously missing something here, as this confuses me somewhat. Does
the magical / make the empty a element valid? And doesn''t this violate
http://www.w3.org/TR/xhtml1/#C_3 ?

Nearest I can figure, it''s recommending that although the tag will
validate, we still shouldn''t do it in case a UA can''t handle an empty a
element. Am I on the right track?

If not, feel free to correct me.

推荐答案

Neal <是ne ***** @ spamrcn.com>写道:
Neal <ne*****@spamrcn.com> wrote:
根据规格
http://www.w3.org/TR/html401/struct/links.html#h-12.2) ,< a>元素
需要一个结束标记。因此,当我们使用< A NAME =" foo">在HTML 2.0到
4.01中,它不会验证,它会想要找到< / A>标签。

然而,当我写一个文件,包含,例如,< a name =" foo" />它在XHTML 1.0中验证。

我显然在这里遗漏了一些东西,因为这让我感到困惑。
魔法/使空元素有效吗?并且这不违反
http:// www。 w3.org/TR/xhtml1/#C_3

最近我可以想,它建议虽然标签会验证,但我们仍然不应该如果UA无法处理空的
元素,请执行此操作。我是在正确的轨道上吗?
According to the specs
(http://www.w3.org/TR/html401/struct/links.html#h-12.2), the <a> element
requires an end tag. And so, when we use <A NAME="foo"> in HTML 2.0 to
4.01, it won''t validate, it''ll want to find the </A> tag.

However, when I write a document containing, say, <a name="foo" /> it
validates in XHTML 1.0.

I''m obviously missing something here, as this confuses me somewhat. Does
the magical / make the empty a element valid? And doesn''t this violate
http://www.w3.org/TR/xhtml1/#C_3 ?

Nearest I can figure, it''s recommending that although the tag will
validate, we still shouldn''t do it in case a UA can''t handle an empty a
element. Am I on the right track?




考虑完全放弃愚蠢的构造:


< h3 id =" s5" ;>第5节< / h3>


-

Spartanicus



Consider dropping the silly construct completely:

<h3 id="s5">Section 5</h3>

--
Spartanicus


Neal:< br>
Neal:
根据规格
http://www.w3.org/TR/html401/struct/links.html#h-12.2) ,< a>元素
需要一个结束标记。因此,当我们使用< A NAME =" foo">在HTML 2.0到
4.01中,它不会验证,它会想要找到< / A>标签。
但是,当我写一个文件,其中包含< a name =" foo" />它在XHTML 1.0中验证。
According to the specs
(http://www.w3.org/TR/html401/struct/links.html#h-12.2), the <a> element
requires an end tag. And so, when we use <A NAME="foo"> in HTML 2.0 to
4.01, it won''t validate, it''ll want to find the </A> tag. However, when I write a document containing, say, <a name="foo" /> it
validates in XHTML 1.0.




在HTML 2.0到4.01中,你必须写< a ...> ...< / a>"。


在XHTML中,你也可以写< a ... />。


规则是不同的。在XHTML中,这样添加了/。在

开始标记的末尾关闭元素。这在旧版HTML中是未知的。


写作"< a ... />"然而,在旧的用户代理中可能不会很好用

对XHTML一无所知。


请查看XHTML 1.0的规范。 />

-

Bertilo Wennergren< be ****** @ gmx.net> < http://www.bertilow.com>



In HTML 2.0 to 4.01 you must write "<a ...>...</a>".

In XHTML you can also write "<a ... />".

The rules are different. In XHTML such an added "/" at the end of a
start tag closes the element. That is unknown in older HTML.

Writing "<a ... />" might however not work well in old user agents that
don''t know anything about XHTML.

Do look up the specification for XHTML 1.0.

--
Bertilo Wennergren <be******@gmx.net> <http://www.bertilow.com>


Spartanicus< me@privacy.net>写道:
Spartanicus <me@privacy.net> wrote:
考虑完全放弃愚蠢的构造:

< h3 id =" s5">第5节< / h3>
Consider dropping the silly construct completely:

<h3 id="s5">Section 5</h3>




如果您需要或希望让您的文档处于工作状态,这并不傻。

Netscape 4也是如此。糟糕的浏览器不会跳转到由id

属性定义的锚点,它需要< a name>。我个人正在转向新文件中的id属性

,但有些犹豫。


-

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

关于网页创作的网页: http://www.cs.tut.fi/~jkorpela/www.html



It''s not silly if you need or wish to have your document working on
Netscape 4 too. The poor browser does not jump to anchors defined by id
attributes, it needs <a name>. Personally I''m moving to id attributes
in new documents, mostly, but with some hesitation.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html


这篇关于清空有效与否?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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