var base_url = 'https://www.bapugraphics.com/';

CSS Layout - The display Property

CSS Layout - The display Property

The display property specifies how an element is displayed. Every HTML element has a default display value depending on what type of element it is. The default display value for most elements is block or inline.

Block-level Elements

A block-level element always starts on a new line and takes up the full width available (stretches out to the left and right as far as it can).

Examples of block-level elements:

  • <div>
  • <h1> - <h6>
  • <p>
  • <form>
  • <header>
  • <footer>
  • <section>

Inline Elements

An inline element only takes up width as much as necessary. 

Examples of inline elements:

  • <span>
  • <a>
  • <img>

Display: none;

display: none; is usually used with JavaScript to show and hide elements without deleting and recreating them.

Display Inline Property

Override The Default Display Value

Every element has a default display value and you can override this. Changing an inline element to a block element, or vice versa, can be useful for making the page look a specific way, and still follow the web standards.

 

Display Block Property

Setting the display property of an element only changes how the element is displayed, NOT what type of element it is. So, an inline element with display: block; is not allowed to have other block elements inside it.

The following example of displaying <span> and <a> elements as block elements:

 

Display Hidden Property

Display Hidden

In HTML you can hide any element by just setting the display property to none and the page will be displayed as if the element is not there:

 

Visibility Hidden Property

Visibility Hidden

In HTML you can hide any element by just setting the visibility property to hidden and the element will be hide but it will still take up the same space as before.

 

Display Properties Examples

Display Property Task 1

Display Property Task 2

Display Property Task 3

Display Property Task 4

Contact Details

Mobile Number :
9891 222 738,
9891 50 1300

E-mail : contactbapugraphics@gmail.com

ADDRESS: H-17 / 263, First Floor,Sector 7,
Near Rohini West Metro Station,
Opposite Metro Pillar No. 425
Rohini, Delhi - 110085

Working hours

Day Timing
Monday To Friday 8:00 Am To 7:00Pm
Saturday 10:00 Am To 6:00Pm