Hide an element through css : visibility « Style Layout « JavaScript DHTML






Hide an element through css

 
<html>
<head>
<title>CSS</title>
</head>
<body>
<h1 id="h1element">The Title</h1>
<p id="firstelement">The first element.</p>
<p id="secondelement">The second element.</p>
<script type = "text/javascript" >
var myPs = document.getElementsByTagName("p");
for (var i = 0; i < myPs.length; i++) {
    myPs[i].style.visibility = "hidden";
}
</script>
</body>
</html>

   
  








Related examples in the same category

1.Change the visibility of an element