Yes, it is perfectly fair to use both the ID and Class properties in the same element. Example:
<div class="infoBox" id="myUniqueStyle"> *content* </div>
However, keep in mind that an identifier can only be used once (hence its name), while you can use classes as many times as you want to get the document. You can use both an identifier and a class to apply styles, while only an identifier is an easy way to access an element through javascript.
A good way to do this is to apply identifiers to all unique elements (title, navigation, main containers, etc.) and classes for everything else.
"Is" applies "to elements using an identifier:" This is a navigation bar, "" this is a title "
"Is" or "is" applies "to elements using classes:" This is blogPost "," this is infoBox ", etc.
source share