When working with div elements, you have the flexibility to assign both an id
and a class
. This allows you to apply general styling to all divs with a particular class in the CSS, while also specifying unique styles for individual divs with specific ids.
<div class="main">
<div id="banner1" class="banner_image"> banner 1</div>
<div id="banner2" class="banner_image">banner 2</div>
<div id="banner3" class="banner_image">banner 3</div>
</div>
You can even utilize multiple classes for more dynamic styling:
HTML
<div class="main">
<div id="banner1" class="banner_image small">banner 1</div>
<div id="banner2" class="banner_image big">banner 2</div>
<div id="banner3" class="banner_image">banner 3</div>
</div>
CSS
.small {
font-size:10px;
}
.big {
font-size:20px;
}
I trust this explanation clarifies things for you. Happy coding!