How to Capture ID in CSS Selector in Html

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

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.

Published in: Codes HTML

Search

Looking for something? Search here!
S

Meet the Author

Web Geek, Tech Columnist
A
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.