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

 

Working hours

 

Day Timing
Monday To Friday 8:00 Am To 8:00Pm
Saturday & Sunday 8:00 Am To 5:00Pm
 
 

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

Email: contactbapugraphics@gmail.com
            bapugraphicsindia@gmail.com

Mobile: 9891222738

Copyright © 2014 Bapu Graphics, All Right Reserved.