0
Display: none; ?
What is the purpose and or practical use of making an element of the code not appear if it does not have a function?
3 Respuestas
+ 1
Adding to the previous answer, a good example might be a little game, where you write the menu by using HTML and CSS, since it is really easy to make buttons and stuff for that, but the actual gameplay is rendered onto a separate canvas. You don't really want the canvas to be visible while the user is in the menu, and vice-versa, right? The simple solution is to hide the menu by setting its display property to 'none' when the user hits the 'Play' button, while at the same time showing the canvas by setting its display to any other value, let's say 'initial'. When the game ends, you do it the other way round. This way you can have both elements on the same page without them interfering with each other, and you have a nice responsive application.
+ 1
Thanks Shadow...that helps a lot!