views:

31

answers:

1

Hi,

I have seen an HTML code like this for the ID tag,

id="t1:c3"

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

+1  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.

cxfx
so you mean this will not be advisable also for css?
Eron
That's right, because in CSS the colon is used for pseudo-selectors, like `#div.button:hover`
cxfx
I agree with cxfx, but if there is very big need to use colons, then you can escape it on css like `#t1\:c3 { rules ;}`
Sotiris