# More than one instance of the same class?

**URL:** https://forum.kirupa.com/t/more-than-one-instance-of-the-same-class/265292
**Category:** web dev
**Created:** [July 7, 2008, 2:39pm UTC](https://forum.kirupa.com/t/more-than-one-instance-of-the-same-class/265292 "2008-07-07T14:39:47Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jpearson311](https://avatars.discourse-cdn.com/v4/letter/j/977dab/32.png) [@jpearson311](https://forum.kirupa.com/u/jpearson311)
#### Post date: [July 7, 2008, 2:39pm UTC](https://forum.kirupa.com/t/more-than-one-instance-of-the-same-class/265292/1 "2008-07-07T14:39:47Z")

</div>

Is this allowed in CSS? Can you have more than one instance of the same class on a page?

---

<div class="post-metadata">

### Author: ![actionAction](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/actionaction/32/3987_2.png) [@actionAction](https://forum.kirupa.com/u/actionAction)
#### Post date: [July 7, 2008, 4:05pm UTC](https://forum.kirupa.com/t/more-than-one-instance-of-the-same-class/265292/2 "2008-07-07T16:05:08Z")

</div>

Yes, that’s the purpose of a css class. You are not supposed to have multiple elements with the same id though, as an id is supposed to be a unique identifier.

---

<div class="post-metadata">

### Author: ![jpearson311](https://avatars.discourse-cdn.com/v4/letter/j/977dab/32.png) [@jpearson311](https://forum.kirupa.com/u/jpearson311)
#### Post date: [July 7, 2008, 4:26pm UTC](https://forum.kirupa.com/t/more-than-one-instance-of-the-same-class/265292/3 "2008-07-07T16:26:54Z")

</div>

Ok cool. That’s what I thought and that’s the way I’ve always done it, but I do know that I’ve had issues with using multiple divs with the same id before. It works, but is not W3 compliant. I was asked this question in a phone interview the other day and answered it correctly, but I’ve never been asked that so I wanted to make sure. Thanks actionAction!

---

<div class="post-metadata">

### Author: ![actionAction](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/actionaction/32/3987_2.png) [@actionAction](https://forum.kirupa.com/u/actionAction)
#### Post date: [July 7, 2008, 4:46pm UTC](https://forum.kirupa.com/t/more-than-one-instance-of-the-same-class/265292/4 "2008-07-07T16:46:50Z")

</div>

No problem, :thumb2: Hope you get the job!

🍺 here’s to guessing during interviews (hopefully I will be doing some of that soon).
