4 ms·
I think the main advantages are that you don't have to remember to add "display:none", and that it gives the structure more semantic meaning. If I look at your
by Stamp01 4y ago
I think the main advantages are that you don't have to remember to add "display:none", and that it gives the structure more semantic meaning. If I look at your code and see "display:none", I don't know why you've chosen to hide it. If it's wrapped in a <template> element, I instantly know why it's not being displayed as I now have an idea of how it's going to be used.
- galaxyLogic 4y agoYes but when you see "display:none;" isn't it obvious that the purpose is to make it visible sometime later? Also if you need to use the same HTML elsewhere, just copy the innerHTML of such an element and insert anywhere you want to.
- forgotusername6 4y agoHidden forms are an example of display:none that will not be displayed later
- xigoi 4y ago> Yes but when you see "display:none;" isn't it obvious that the purpose is to make it visible sometime later? Yes, but it's not obvious that it would be made visible in a different place while keeping the original invisible.