The Display Property Flashcards

1
Q

What does the display property do?

A

Determines how an element’s box is rendered in the browser.

Can be inline, block-level, and inline-block.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Describe inline elements.

A
  • Doesn’t start on a new line and usually does not contain additional elements, but instead just contains text.
  • You can’t explicitly set the width, height, margin, or padding of an inline element; instead, its dimensions are determined by how much space its contents require.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Describe block-level elements

A
  • Gets displayed on a new line (and takes up the whole available line)
  • May contain additional block-level or inline elements
  • And its height and width can be explicitly set.
  • By default, block-level elements will take up the entire width of whatever element they appear inside of, but we can override this by explicitly setting the width or max-width property on an element.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Describe inline-block elements.

A
  • Displays inline
  • CAN give it an explicit width, height, margin and padding.
  • Can be a good approach when you need to create elements with a set width, but also need them to display side-by-side.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can you horizontally center a block-level content within some parent element?

A

margin-left: auto;

margin-right: auto

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How can you center inline elements within a block element?

A

text-align: center;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly