Frontend Development

HELP! DIFFERENCE BETWEEN DIV CLASS AND DIV ID

Submitted by Avocat, , Thread ID: 61633

Thread Closed

RE: HELP! DIFFERENCE BETWEEN DIV CLASS AND DIV ID

#10
Class is for styles and references to stylesheets, don't use these as they're not unique, unless of course you are trying to style multiple elements (if not just one element) with the same stylings.... Hence: Cascading Style Sheet.
ID's are unique and meant to only be used by one element, such as clicking a button. Clicking the second button should NOT have the same ID as they'll both do the same thing, or will activate things that are meant to change the buttons style for example, and they both end up changing. These should be unique.
"It never hurts to keep looking for sunshine" - A. A. Milne

Users browsing this thread: 2 Guest(s)