类属性值 [英] Class attribute values

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

问题描述



虽然''id''和''name''属性的值包含对

使用字符的限制,例如以字母开头,

''class''属性的值定义没有限制因为我能找到。


因此使用:


class =" thumbedImage 0.4"


是允许的,可以用作IMG元素中的属性来识别

图像的大小我希望通过脚本函数调用加载

文档正文来动态更改,如onload;属性是

规范中的IMG元素不允许。

(脚本函数本质上会得到一个图像元素节点列表

来自文档正文,检查正确值的存在

的类属性值,然后更改那些具有

所需值的图像。)


有没有人对规范的理解与这个理解不同?


While the values of ''id'' and ''name'' attributes include restrictions on the
use of characters such as beginning with a letter, the values of the
''class'' attribute define no restriction as I can find.

Thus the use of:

class="thumbedImage 0.4"

is permitted, and could be used as an attribute in IMG elements to identify
images whose sizes I want to change dynamically with the loading of the
document body through a script function call, as the "onload" attribute is
not allowed for IMG elements in the specification.
(The script function essentially would get a list of image element nodes
from the document body, examine the class attribute values for the presence
of the correct values, and then make changes to those images having the
required values.)

Is there anyone whose understanding of the specification differs from this
understanding?

推荐答案

患者Guy< Pa ********* @ nowhere.to.be.found.com>写道:
Patient Guy <Pa*********@nowhere.to.be.found.com> wrote:
虽然''id''和''name''属性的值包括对字母使用的限制,例如以字母开头,值
''class''属性定义没有限制,因为我可以找到。

因此使用:

class =" thumbedImage 0.4" <允许,
While the values of ''id'' and ''name'' attributes include restrictions on the
use of characters such as beginning with a letter, the values of the
''class'' attribute define no restriction as I can find.

Thus the use of:

class="thumbedImage 0.4"

is permitted,




上面为元素分配了两个类,thumbedImage和和0.4,

不允许后者,因为不允许类名用数字开始

http://www.w3.org/TR/CSS21/syndata.html#q6 < br $>

-

Spartanicus



The above assigns two classes to the element, "thumbedImage" and "0.4",
the latter is not permitted since class names are not allowed to start
with a digit: http://www.w3.org/TR/CSS21/syndata.html#q6

--
Spartanicus


2005年11月7日星期一07:27:04 GMT,耐心的家伙

< Pa ********* @ nowhere.to.be.found.com>写道:
On Mon, 07 Nov 2005 07:27:04 GMT, Patient Guy
<Pa*********@nowhere.to.be.found.com> wrote:
虽然''id''和''name''属性的值包括对字母使用的限制,例如以字母开头,值
''class''属性定义没有限制,因为我可以找到。

因此使用:

class =" thumbedImage 0.4"

是允许的,可以用作IMG元素中的一个属性来识别我想要通过脚本函数调用加载
文档体动态变化的图像,作为onload,属性是不允许在规范中的IMG元素。
....是否有人对规范的理解与此理解不同?
While the values of ''id'' and ''name'' attributes include restrictions on the
use of characters such as beginning with a letter, the values of the
''class'' attribute define no restriction as I can find.

Thus the use of:

class="thumbedImage 0.4"

is permitted, and could be used as an attribute in IMG elements to identify
images whose sizes I want to change dynamically with the loading of the
document body through a script function call, as the "onload" attribute is
not allowed for IMG elements in the specification. ....Is there anyone whose understanding of the specification differs from this
understanding?



好​​吧,我无法立即找到禁止它的东西。但是:


class =" thumbedImage 0.4"分配类thumbedImage和元素的0.4



在CSS中,img.0.4 {...}将引用具有0级和0级的图像

班级4.


实际上在CSS中:标识符(包括元素名称,类和ID

in选择器)只能包含字符[A-Za-z0-9]和ISO 10646

字符161和更高,加上连字符( - );它们不能以

连字符或数字开头。


即使你可以在HTML类名中使用句点,在我看来它也是如此

是不可取的。


-

Stephen Poley

http://www.xs4all.nl/~sbpoley/webmatters/


Spartanicus写道:
Spartanicus wrote:
上面为元素分配了两个类,thumbedImage和和0.4,
后者是不被允许的,因为类名不允许以数字开头
http://www.w3.org/TR/CSS21/syndata.html#q6
The above assigns two classes to the element, "thumbedImage" and "0.4",
the latter is not permitted since class names are not allowed to start
with a digit: http://www.w3.org/TR/CSS21/syndata.html#q6




在HTML中,类名* *允许以数字开头。但是,如果您选择使用以数字开头的类名,则不能使用CSSdot-class选择它们

。选择器 - 这是不开始的类
带字母的
对样式不是特别有用,但可以用于

通用元素子类化。 )


(当然你可以使用* [class~ =" 0.4"]在CSS中选择它们,虽然

浏览器支持这种语法是不太普遍。)


-

Toby A Inkster BSc(荣誉)ARCS

与我联系〜 http://tobyinkster.co.uk/contact



In HTML, class names *are* allowed to start with a digit. However, if you
choose to use class names that start with a digit, you can''t select them
using the CSS "dot-class" selector -- that is classes that don''t start
with a letter aren''t particularly useful for styling, but can be used for
general purpose element subclassing.)

(Of course you can select them in CSS using *[class~="0.4"], though
browser support for this syntax is less widespread.)

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact


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

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