How to Capture ID in CSS Selector in Html

Written by Sarmad Gardezi April 4, 2020

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.

HTML:

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

CSS:

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

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


Subscribe to my Email Newsletter

Enter your email address to subscribe to this blog and receive notifications of new posts by email.