All TalkersCode Topics

Follow TalkersCode On Social Media

CSS Display and Visibility

CSS Display property is used to specify how element is displayed.And CSS Visibility is used to show or hide an element


Example of Display

li
{
display:inline;
}

Display Values

  • display:inline; is used to make elements displayed in a single line

  • display:block; is used to make elements displayed one in a line that is it takes full width available

  • display:none; is used to hide the elements and it will not take any spaces.



Example of Visibility

li
{
visibility:hidden;
}

Visibility Values

  • visibility:hidden; is used to hide elements but it will take same spaces as before.

  • visibility:visible; is used to show the elements

  • visibility:collapse; is used only with dynamic table columns and row effects.


Block Elements

  • <h1>
  • <p>
  • <li>
  • <div>


  • Inline Elements

  • <span>
  • <a>
  • ❮ PrevNext ❯