I need to change the visibility of div. Is it acceptable to write inline style in div in a small project? Here’s an example:
FIRST:
<div class="test" style="display: none">TEXT</div>
SECOND:
<div class="test hidden">TEXT</div>
And I have js-script to switch class for the first option and to switch inline style to “display: block”
Which one is better and why?
For some reason it seems to me that inline styles are worse. But, most likely, the project will not be expanded or modified. Therefore, I have doubts that using classes in this case is better.
Oleg Kasaev is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.