I am making an HTML document containing many entries. Each entry is one of 3 or 4 categories, and contains a category-identifying icon. Each entry now looks like this:
and so on. But what I would really like to do is make a different div class for each category, which *includes* the image. Then for each entry I would only have to put:
Is it possible (or good practice) to specify *content*, such as repetitive text or images, in a div class definition?
Code:
<div class="entryIcon">
<img src="iconCategoryA.jpg">
</div>
<div class="entry">
Here is the text of an entry for category A
</div>
<div class="entryIcon">
<img src="iconCategoryB.jpg">
</div>
<div class="entry">
Here is the text of an entry for category B
</div>
Code:
<div class="entryCategoryA">
Here is the text of an entry for category A
</div>
<div class="entryCategoryB">
Here is the text of an entry for category B
</div>