I had two <h2>
headings in html. I wanted to style them separately using CSS. For that I tried to use numbers ‘1’ and ‘2’ as class names. But when I tried to select them using h2.1
, h2.2
in CSS selectors, it did not work.
I then googled and got to know there are some characters not allowed a CSS selectors. Now I know there are some rules for selectors. But I am wondering the reason why CSS has prohibited some characters as selectors?
I could not find the reason behind this using google. Only the rules and allowed characters are available in Google. Can someone explain the reason why some characters are not allowed as selectors?
Yousuf Ithfi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1