Why would someone want to set the display of an element to none? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why would someone want to set the display of an element to none?

Would it be that the web designer wants to revise the content of such an element? If so, why not use an HTML comment? Can someone please provide some insight?

3rd Feb 2016, 5:26 PM
Stefan Farier
Stefan Farier - avatar
2 Answers
+ 4
display:none most is used by javascript you set for example element1 to display:none so that element isn't shown and then say html that when client clicked on an another element for example element 2 run a javascript finction that its duty is to changing element1 display property to for example inline one sample of this code is in creating menus that client just sees menus titles but when clicks on a title its submenus appears and it can chose one
22nd Feb 2016, 6:12 AM
amir nassaji
amir nassaji - avatar
+ 2
you might use display:none on some situations were you want the element to not be on the display for some condiction, and out of this condiction you want it displayed
10th Mar 2016, 11:04 AM
Rafael Henrique Camargo
Rafael Henrique Camargo - avatar