Check out example codes for "how to hide div in html". It will help you in understanding the concepts better.

Code Example 1


Code Example 2

<button onclick="myFunction()">Click Me</button>

<div id="myDIV">
This is my DIV element.

Code Example 3

document.querySelector("#test").hidden = true;
document.querySelector("#test").hidden = false;

Code Example 4

/*Hiding an element can be done by setting the display property to none. 
The element will be hidden, and the page will be displayed as if the element is not there:

h1.hidden {
  display: none;

/*visibility:hidden; also hides an element.
However, the element will still take up the same space as before. 
The element will be hidden, but still affect the layout:

h1.hidden {
  visibility: hidden;

Code Example 5


Learn ReactJs, React Native from