I expect to switch the element's visibility: should I start with class = "..." or style = "..."?

If I have an element on a webpage that I expect to show and hide quite a bit using javascript, what would be the most appropriate way to set it as initially invisible?

<div class="hidden">...</div>

or

<div style="display: none;">...</div>

Use is class="..."preferable style="..."in most cases, but I'm not sure if it works best in this case. Semantically, my element is not a hidden element, it is only one that starts to hide when the page first loads. Since I use the jQuery show () and hide () methods, this means that it is often in this state:

<div class="hidden" style="display: block;">...</div>

.. for me it's just stupid.

, style="display: none;" - .

, , , ?

+5
3

initially-hidden. , - jQuery.

+5

, , "" none ", . , " hidden "" ", . , .

+4

, -, , , . , - , , " ", .

, , , . , , , , hide() jQuery.

0
source

All Articles