XHTML 1.1中的ID属性 [英] ID attribute in XHTML 1.1

查看:75
本文介绍了XHTML 1.1中的ID属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实际上并没有在网上使用它,但任何人都可以告诉我为什么< style>上的ID

属性标签在W3C验证器中导致

XHTML 1.1文档出错?对于XHTML 1.0或HTML

文档,它没有问题。


我只是在玩一些包含嵌入式<的测试代码br />
样式表并使用<?xml-stylesheet type =" text / css"在DOCTYPE之前的href ="#styles"?>

(我认为这是你在技术上应该用XML做的
)但是使用< style type =" text / css" ID = QUOT;样式和QUOT;>导致

错误 - 仅当我使用XHTML 1.1文档类型时。


对于真实页面我使用HTML 4,我只是在XHTML 1.1中玩看看

浏览器用它做了什么,如果验证与否,我很好奇为什么

ID不允许在所有标签上使用。

解决方案

" Bert Lancaster" <无**** @ yahoo.com>写道:

我实际上并没有在网上使用它,但任何人都可以告诉我为什么< style>上的ID
属性标签导致W3C验证器中出现错误的
XHTML 1.1文档?对于XHTML 1.0或HTML
文档来说没有问题。




我认为咨询

文件?


< http://www.w3.org/TR/xhtml-modularization/abstract_modules.html#s_stylemodule>

-

|||十六进制EBB

oo十进制3771

--oOo - () - oOo--八进制7273

205再见二进制111010111011


2006年5月18日星期四10:45:00 +0100,Eric B. Bednarz

< be ***** @ fahr-zur -hoelle.org>写道:

我认为查阅
文档会有太多麻烦吗?

< http://www.w3。 org / TR / xhtml-modularization / abstract_modules.html #s_stylemodule>




是什么让你认为我还没有,嗯?但感谢

链接到我昨晚所寻找的内容。


因此,< style>上不允许使用ID属性。 XHTML 1.1中的标签。可以

其他人告诉我为什么这个从XHTML 1.0改变了什么应该是

严格来说,因为使用ID是推荐的

文件按XML格式发送:

< http://www.w3.org/TR/xhtml1/#C_14>

Bert Lancaster< no **** @ yahoo.com> scripsit:

因此,< style>上不允许使用ID属性。 XHTML 1.1中的标签。


是的,这是您需要从

形式化语法(即DTD)中找到的无声更改之一。

其他人可以告诉我为什么这个从XHTML 1.0改变了吗?


XHTML 1.1的作者并没有打扰_改变

"信息"附件据称记录了这些变化,
http:/ /www.w3.org/TR/xhtml11/changes.html#a_changes

所以我认为期望他们解释他们的理由是不现实的。


但是,这一特殊变化听起来并不重要。

在哪里你需要< style>的id属性元件?它在链接中没用,

并且它在编写样式表时没用。它可以用在

客户端脚本中,称为DHTML。或Ajax或Ajax。取决于

marketese的年份。但是,我希望你有兴趣操纵CSS

规则,而不是它们出现在XHTML源代码中的元素。

以及
应该严格执行的操作因为使用ID是对于根据此发送为XML的文档所推荐的内容:
< http://www.w3.org/TR/xhtml1/#C_14>



根据该建议,这一变化看起来确实很奇怪。另一方面,

,你可以通过制作你的样式表外部来避免这个问题,即不使用< style>元素。


也许他们虽然XHTML 1.1文档不应该作为XML提供?


I''m not actually using it on the web but can anyone tell me why the ID
attribute on a <style> tag causes an error in the W3C validator for an
XHTML 1.1 document? It doesn''t have a problem for a XHTML 1.0 or HTML
document.

I was just playing around with some test code that contained an embedded
stylesheet and used <?xml-stylesheet type="text/css" href="#styles"?>
before the DOCTYPE (which I think is what you''re technically supposed to
do with XML) but using <style type="text/css" id="styles"> causes the
error - only if I use an XHTML 1.1 doctype.

For real pages I use HTML 4, I was just playing around in XHTML 1.1 to see
what browsers did with it, and if it validated or not and am curious why
ID is not allowed on all tags.

解决方案

"Bert Lancaster" <no****@yahoo.com> writes:

I''m not actually using it on the web but can anyone tell me why the ID
attribute on a <style> tag causes an error in the W3C validator for an
XHTML 1.1 document? It doesn''t have a problem for a XHTML 1.0 or HTML
document.



I suppose it would have been too much hassle to consult the
documentation?

<http://www.w3.org/TR/xhtml-modularization/abstract_modules.html#s_stylemodule>
--
||| hexadecimal EBB
o-o decimal 3771
--oOo--( )--oOo-- octal 7273
205 goodbye binary 111010111011


On Thu, 18 May 2006 10:45:00 +0100, Eric B. Bednarz
<be*****@fahr-zur-hoelle.org> wrote:

I suppose it would have been too much hassle to consult the
documentation?

<http://www.w3.org/TR/xhtml-modularization/abstract_modules.html#s_stylemodule>



And what makes you suppose that I haven''t already, hm? But thanks for the
link to what I was looking for last night.

So, the ID attribute isn''t allowed on <style> tags in XHTML 1.1. Can
anyone else tell me why this was changed from XHTML 1.0 and what should be
done strictly speaking since using an ID is what''s recommended for
documents sent as XML according to this:
<http://www.w3.org/TR/xhtml1/#C_14>


Bert Lancaster <no****@yahoo.com> scripsit:

So, the ID attribute isn''t allowed on <style> tags in XHTML 1.1.
Yes, this is one of the silent changes that you need to find out from the
formalized syntax, i.e. DTD.
Can anyone else tell me why this was changed from XHTML 1.0
The authors of XHTML 1.1 didn''t bother _mentioning_ the change in the
"informative" annex purported to document the changes,
http://www.w3.org/TR/xhtml11/changes.html#a_changes
So I think it''s unrealistic to expect them to _explain_ their reasons.

This particular change does not sound very important, though. Where would
you need the id attribute for a <style> element? It''s not useful in linking,
and it''s not useful in writing stylesheets. It could perhaps be used in
client-side scripting, called "DHTML" or "Ajax" depending on the vintage of
marketese. However, I would expect you to be interested in manipulating CSS
rules rather than the elements where they appear in XHTML source.
and what
should be done strictly speaking since using an ID is what''s
recommended for documents sent as XML according to this:
<http://www.w3.org/TR/xhtml1/#C_14>



In the light of that recommendation, the change looks rather odd indeed. On
the other hand, you can circumvent the problem by making your style sheet(s)
external, i.e. by not using the <style> element.

Perhaps they though that XHTML 1.1 documents should not be served as XML?


这篇关于XHTML 1.1中的ID属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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