Hello everybody
HOWDY? I have lot confusion about using id/class in CSS. When there is a need to use id and when there is a need to use class? What is the difference between id/class in CSS.Either there a standard way for the naming convention in css for the id/class that has to be reference by HTML? or its up to the developer?
Thank you all.

Recommended Answers

All 2 Replies

Think of a class as a class in school. The class contains many students. Think of id as a unique student in the class.

Use a class when you have many elements that need the same style applied.

Use an id when the element will only be used once on the page. Things like a banner, navigation bar, or footer are commonly only used once per page.

yeah i guess its solved thx to buddy lee

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.