Two Classes in a Div…Two IDs in a Div?

Yes, you can assign two classes in a div.

CSS:

.class-1 {border: 3px dotted pink;}
.class-2 {background-color: orange;}

HTML

<div class=”class-1 class-2″>
This div should have 2 classes. 1 with a pink border and the other with a orange background.
</div>

You can also assign an id and and class to a single div:

CSS: 

#id-1 {color: blue;}

HTML: 

<div class=”class-1″ id=”id-1″>
This div should have 1 Class and an ID. The class will have a pink dotted border and the id will have the text as the color blue.
</div>

Now…drum roll please! Can you attach two ids to a single div???

CSS:

#id-1 {color: blue;}
#id-2 {text-decoration: underline;}

HTML:

<div id=”id-1 id-2″>
A div cannot have two ids, as shown here.
</div>

No, the answer is no. A single element cannot have two ids assigned to it. Oh well, no one said life would be easy.