HTML id 属性中的冒号是什么意思? [英] What does a colon mean within an HTML id attribute?

查看:49
本文介绍了HTML id 属性中的冒号是什么意思?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了这样一个用于 ID 属性的 HTML 代码:

I have seen an HTML code like this for the ID attribute:

id="t1:c3"

谁能给我解释一下?冒号 (:) 的用途是什么?

Can someone explain this to me? What is the purpose of the colon (:)?

谢谢.

推荐答案

ID 属性中允许使用冒号,但没有特殊意义.不建议使用它们,因为它们有时会导致问题,例如与 jQuery 或 CSS 一起使用时,冒号作为伪选择器具有特殊含义.

Colons are allowed inside ID attributes, but hold no special significance. It's not really advisable to use them because they can sometimes cause problems, such as when used with jQuery or CSS, where the colon has special meaning as a pseudo-selector.

这篇关于HTML id 属性中的冒号是什么意思?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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