IT Questions and Answers :)

Friday, June 21, 2019

Which CSS property is used to hide an element and will not affect the layout?

Which CSS property is used to hide an element and will not affect the layout?

  • visibility: hidden;
  • display: none;
  • display: false;
  • visibility: false; 
Which CSS property is used to hide an element and will not affect the layout?

EXPLANATION

<!DOCTYPE html>
<html>
<head>
<style>
h2.a {
  visibility: visible;
}

h2.b {
  visibility: hidden;
}
</style>
</head>
<body>

<h1>The visibility Property</h1>

<h2 class="a">This heading is visible</h2>

<h2 class="b">This heading is hidden</h2>

<p>Notice that the hidden heading still takes up space on the page.</p>

</body>
</html>

 Output

The visibility Property

This heading is visible

Notice that the hidden heading still takes up space on the page.


Source

https://www.w3schools.com/CSSref/tryit.asp?filename=trycss_visibility

 

Share:

0 comments:

Post a Comment

Popular Posts