What does a colon mean within an HTML id attribute?

[stackoverflow]

Q. 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 (:)? Thank you.

A. 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.

A. If the HTML is generated with Java ServerFaces this usually produces such IDs, i.e. if the form has the ID form1 and the element has the ID firstName this results in an ID form1:firstName.

我. 博客园的语法高亮:<div class="cnblogs_Highlighter"><pre class="brush:python;collapse:true;;gutter:false;">

<style>
.A {color:red}
.B {text-decoration:underline}
</style>
<p>classname 规定元素的类的名称。如需为一个元素规定多个类,用空格分隔类名。HTML 元素允许使用多个类。</p>
<p class="A B">classname 规定元素的类的名称。如需为一个元素规定多个类,用空格分隔类名。HTML 元素允许使用多个类。</p>
<p class="A;B">classname 规定元素的类的名称。如需为一个元素规定多个类,用空格分隔类名。HTML 元素允许使用多个类。</p>

上面的pre只属于一个类,它的名字是brush:python;collapse:true;;gutter:false;  a semicolon(;) doesn't separate class names.

噢,我忘了我在哪个帖子里放了个厥词说formal English里不用',如doesn't要写成does not. 我是误信了词典啊,起码IBM在它的官网上don't多的是——它还是穿西装不是穿T恤的公司。

posted @   Fun_with_Words  阅读(48)  评论(0编辑  收藏  举报
(评论功能已被禁用)
编辑推荐:
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?









 和6张牌。

点击右上角即可分享
微信分享提示