How to Capture ID in CSS Selector in Html

Published in: Codes HTML

When I tried to build the table and tried to add colors, I encountered some problems.

In Wiz Wiz I defined it css selector , but the selector does id   not work well.

Why doesn’t the selector work?

And how to solve it? ID cannot start with a number. A good solution is to add a meaningful name before the number. And, as ellitt said, the id in html should be enclosed in quotation marks.


<text id="alert1">Some text</text>
<text id="alert2">Some text</text>


#alert1 {
    background-color: blue;
#alert2 {
    background-color: green;

If you still have an issue you can use the contact page for more info.

Published in: Codes HTML


Looking for something? Search here!

Meet the Author

Web Geek, Tech Columnist
Sarmad Gardezi

Sarmad Gardezi is a Google Developer Expert in GSuite and Google Apps Script. He is doing an engineering degree in Software Engineering, and is the professional blogger from islamabad, Pakistan. Read more on Lifehacker and YourStory

Get in touch

About Me

I cover all the aspects of digital marketing. You will find free content around Blogging, SEO, WordPress, Web-hosting and making money online.