What is the difference between these two?


#1

Hi all, I have just noticed that sometimes in the instructions you use div.container and other times you use .container so what is the difference between the two of them and thanks for helping.


#2

div.container is targeting a div that has a class attribute of container. In HTML it would look something like this:

<div class="container">
     <!-- some content goes in here -->
</div>

.container is target any element that has the class attribute of container. It doesn’t just have to be a div. It could be a p, section, ul, aside or whatever. For example:

<section class="container">
     <!-- some content goes in here -->
</section>

#5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.