When we create a <div> or a <nav> element, we also assign a class attribute to it. For example,
<div class="nav-wrapper">
I read that this class attribute is used to style the container at a later stage using CSS. My question is that if this class attribute is used merely for referencing, can it assume any arbitrary names?
For example, can we write <div class="sitepoint"> etc. ?
The answer is “almost any name”… there are a few special character restrictions such as a classname cannot start wtih a digit. class=“column1” is valid, class=“1column” is not.
It is generally recommended that the classname reflect the purpose or function of the element. A classname of “sitepoint” would be functionally very ambiguous