Edit This Code:
<!DOCTYPE html>
<html>
<title>W3.CSS</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../lib/w3.css">
<body>

<div class="w3-container">
  <h2>Hiding Containers</h2>
  <p>Hiding a container can be done using an onclick event on a w3-closebtn:</p>
</div>

<div class="w3-container w3-red">
  <span onclick="this.parentElement.style.display='none'" class="w3-closebtn">x</span>
  <p>To hide this container, click on the X in the upper right corner.</p>
  <p>To hide this container, click on the X in the upper right corner.</p>
  <p>To hide this container, click on the X in the upper right corner.</p>
</div>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy