CSS Flashcards

1
Q

What is a box model?

A

A box that wraps around every HTML element. It consists of content, padding, border & margins.

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

What is specificity?

A

When the browser decides which CSS property value is most relevant and applies it.
For ex., CSS of an ID overrides CSS
of a class unless !important is used

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

What is Static positioning?

A

Default position, element remains in the natural flow of the page. Top, bottom, left, right, and z-index don’t apply.

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

What’s the difference between “resetting” and “normalizing” CSS? Which would you choose, and why?

A

Resetting - is meant to strip all default browser styling on elements. For e.g. margins, paddings, font-sizes of all elements are reset to be the same. You will have to redeclare styling for common typographic elements.

Normalizing - Normalizing preserves useful default styles rather than “unstyling” everything. It also corrects bugs for common browser dependencies.

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

Describe floats and how they work

A

Floated elements remain a part of the flow of the page, and will affect the positioning of other elements will affect the positioning of other elements. (e.g. text will flow around floated elements)

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

Describe z-index and how stacking context is formed.

A

The z-index property in CSS controls the vertical stacking order of elements that overlap. z-index only affects elements that have a position value which is not static.

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