Class 6 Exam  >  Class 6 Notes  >  CSS for Beginners  >  CSS- Display

CSS- Display | CSS for Beginners - Class 6 PDF Download

CSS Layout - The display Property


The display property is the most important CSS property for controlling layout.
The display Property
The display property specifies if/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.
Click to show panel

  • This panel contains a <div> element, which is hidden by default (display: none).
  • It is styled with CSS, and we use JavaScript to show it (change it to (display: block).

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).

CSS- Display | CSS for Beginners - Class 6
Examples of block-level elements:

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

This doc is part of
10 videos|41 docs|23 tests
Join course for free

Inline Elements


An inline element does not start on a new line and only takes up as much width as necessary.
This is CSS- Display | CSS for Beginners - Class 6 a paragraph.
Examples of inline elements:

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

Download the notes
CSS- Display
Download as PDF
Download as PDF

Display: none;


display: none; is commonly used with JavaScript to hide and show elements without deleting and recreating them. Take a look at our last example on this page if you want to know how this can be achieved.
The <script> element uses display: none; as default.

Take a Practice Test
Test yourself on topics from Class 6 exam
Practice Now
Practice Now

Override The Default Display Value


As mentioned, every element has a default display value. However, 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.
A common example is making inline <li> elements for horizontal menus:
Example

li {

  display: inline;

}

Note: Setting the display property of an element only changes how the element is displayed, NOT what kind of element it is. So, an inline element with display: block; is not allowed to have other block elements inside it.
The following example displays <span> elements as block elements:
Example

span {

  display: block;

}

The following example displays <a> elements as block elements:
Example

a {

  display: block;

}

The document CSS- Display | CSS for Beginners - Class 6 is a part of the Class 6 Course CSS for Beginners.
All you need of Class 6 at this link: Class 6
Are you preparing for Class 6 Exam? Then you should check out the best video lectures, notes, free mock test series, crash course and much more provided by EduRev. You also get your detailed analysis and report cards along with 24x7 doubt solving for you to excel in Class 6 exam. So join EduRev now and revolutionise the way you learn!
Sign up for Free Download App for Free
10 videos|41 docs|23 tests

Up next

10 videos|41 docs|23 tests
Download as PDF

Up next

Explore Courses for Class 6 exam
Related Searches

Exam

,

CSS- Display | CSS for Beginners - Class 6

,

ppt

,

pdf

,

Viva Questions

,

mock tests for examination

,

CSS- Display | CSS for Beginners - Class 6

,

practice quizzes

,

Summary

,

study material

,

Sample Paper

,

CSS- Display | CSS for Beginners - Class 6

,

Semester Notes

,

shortcuts and tricks

,

video lectures

,

MCQs

,

Previous Year Questions with Solutions

,

past year papers

,

Extra Questions

,

Free

,

Objective type Questions

,

Important questions

;