CSS Tutorial



CSS DISPLAY


CSS display Property

The display property specifies how an HTML element is displayed on the page. It is one of the most important layout properties in CSS.

๐Ÿ”น Common Values:

  • block โ€“ Element takes full width and starts on a new line.
  • inline โ€“ Element fits within content flow, doesn't start on a new line.
  • inline-block โ€“ Like inline but allows setting height and width.
  • none โ€“ Hides the element completely.
  • flex โ€“ Enables flexible layouts (covered in Flexbox section).

๐Ÿงช Live Example:

Below are three boxes using display: inline-block. They sit next to each other:

Box 1
Box 2
Box 3

๐Ÿ’ก CSS Code:

.box {
  display: inline-block;
  width: 80px;
  height: 80px;
  margin: 5px;
}

๐Ÿ“Œ Notes:

  • display: none; removes the element from layout (not just hiding it).
  • inline-block lets you style elements like blocks without breaking the line.
  • Understanding display is crucial for building modern responsive layouts.

๐ŸŒŸ Enjoyed Learning with Us?

Help others discover Technorank Learning by sharing your honest experience.
Your support inspires us to keep building!

Leave a Google Review