HTML文档中的元素ID〜命名问题 [英] Element ID in HTML Document ~ Naming Question

查看:121
本文介绍了HTML文档中的元素ID〜命名问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在元素ID中插入空格字符时,是否有任何问题(技术上或其他方面)例如,像这样:

Are there any issues (either technically, or otherwise) with putting a space character in an element ID? For example, something like this:

<li id='something with spaces'>Test123</li>

我明白这是不可取的( ),但我已经打了scneario,如果可能,我需要这样做。

I understand that this is NOT desirable (I have never used spaces before), but I have hit a scneario where I need to do this if possible.

潜在问题面对缩放,任何特定的浏览器,脚本或CSS样式?

What are the potential issues (if any) I may face with scaling, any particular browsers, scripting, or CSS styling?

是否有任何文章谈论可以使用但不应该使用的坏字符 ?

Are there any articles that talk about the 'bad characters' that CAN be used but SHOULD NOT be used?

感谢 -

推荐答案

Per 标准


ID和NAME令牌必须以
字母([A-Za-z])开头,并且可以跟随
任意数量的字母,数字
([ 0-9]),连字符( - ),下划线
(_),冒号(:)和句号
(。)。

ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

通过打破此规则,您的(无效)HTML的标准兼容处理器可能会遇到麻烦。因此,我建议您不要

By breaking this rule you'r likely to run into no end of trouble from standard-complying processors of your (invalid) HTML. So, I would recommend you don't do this.

这篇关于HTML文档中的元素ID〜命名问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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