Hello everyone!
what is different bettween ID(#name) and class(.name) in CSS?
but i think it is the same!


Pleae tell me!
<URL SNIPPED>

Recommended Answers

All 4 Replies

ID can be used only once in a page but class can be repeated any number of times.

You would use ID for something that will be used only once per page, like wrapper , header or footer .

Class can be used as many times as you desire, and would be used for something like post_title , post_content or post_metadata .

(blogishly speaking)

Both answers are completely correct. Rule of thumb though, IDs are unique, classes aren't, hence only using them once in a page.

Thank everyone I see!

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.