10 most used CSS Display Values🔥 Open this🧵

@Shefali__J
Shefali@Shefali__J
44 views Nov 06, 2024 ~2 min read
Advertisement
1
10 most used CSS Display Values🔥

Open this🧵
Media image
2
🎯display: block;

Elements with display property ‘block’ starts on a new line and take the entire width of its parent container.

You can set the width and height properties for such elements.

Default block-level elements examples include
,

,

-

,
,
.
Media image
3
🎯display: inline;

If you set an element’s display property to ‘inline’ then it does not start on a new line and takes the width required by its content.

You cannot set the width and height properties for such elements.

Default inline elements examples include , , and .
Media image
4
🎯display: inline-block;

If you set an element’s display property to ‘inline-block’ then it contains the features of both block and inline elements.

It takes up only as much width as necessary, but you can set its height and width properties.
Media image
5
🎯display: flex;

The display: flex; property creates a flex container that can be used for creating flexible layouts.
Media image
6
🎯display: inline-flex;

This property is similar to display: flex; but the element on which display: inline-flex; is applied, behaves like an inline element.
Media image
7
🎯display: grid;

This property transforms the element into a grid container and its children into grid items.

By having grid layouts, you have precise control over both rows and columns.
Media image
8
🎯display: inline-grid;

This property is similar to display: grid; but the element on which display: inline-grid; is applied, behaves like an inline element.
Media image
9
🎯display: none;

If you set an element’s display property to ‘none’, then it will be completely invisible and take up no space within the document.
Media image
10
🎯display: inherit;

If you set an element’s display property to ‘inherit’, then it will inherit the display value from its parent element.

Here,
is a block-level element and is an inline element. The display property of element is set to ‘inherit’, so it will inherit the display value from its parent element (
) and act as a block-level element.
Media image
11
🎯display: initial;

This property sets the display property of an element to its initial value, which is usually inline for most elements.
Media image
12
You can read the complete article here👇
shefali.dev/css-display-va…
13
That's a wrap.

Thanks for checking out.

If you find this helpful, then consider:
❤️Like
✅Follow me @Shefali__J for more content like this.
🔁Repost the below quote👇

@Shefali__J
Shefali@Shefali__J
10 most used CSS Display Values🔥

Open this🧵
Media image
Actions
What You Can Do
  • Export as PDF or Markdown
  • Batch Export to Notion
  • Bookmark & Highlight
  • Screenshot Tweet
Create Free Account

Includes 7-day Premium trial

Advertisement