When crafting HTML templates, my approach is to prefix every class and id. This method not only enhances the readability of the markup but also simplifies the styling process.
As an illustration, if I were to create a template named MyTemplate
, I would prefix all elements like this:
<form id="mt-form-blue" class="mt-form">
<input class="mt-input-large" type="text" />
<input class="mt-input-small" type="text" />
</form>
I have come across numerous HTML templates where creators use minimal classes and ids. This leads me to wonder why that might be the case. Could the usage of many classes and ids potentially impact browser performance or result in any adverse effects?