CSS (Cascading Style Sheets) Flashcards
What are the names of the individual pieces of a CSS rule?
Selector, Declaration Block, Declaration (which contain property and value)
In CSS, how do you select elements by their class attribute?
.
In CSS, how do you select elements by their type?
the name
In CSS, how do you select an element by its id attribute?
#
Name three different types of values you can use to specify colors in CSS.
rgb values, hex code, and color name (most common 3)
What CSS properties make up the box model?
Padding, Border, Margin
Which CSS property pushes boxes away from each other?
Margin
Which CSS property add space between a box’s content and its border?
Padding
What is a pseudo-class?
Classes applied by browser under certain circumstances
What are CSS pseudo-classes useful for?
Applied styling as a result of user interaction
Name at least two units of type size in CSS.
rem, px, %, pt
What is the default flex-direction of a flex container?
row - left to right
What is the default flex-wrap of a flex container?
nowrap
Why do two div elements “vertically stack” on one another by default?
They are block elements
What is the default flex-direction of an element with display: flex?
row - left to right
What is the default value for the position property of HTML elements?
static
How does setting position: relative on an element affect document flow?
It affects its normal document flow
How does setting position: relative on an element affect where it appears on the page?
It stays in the same location
How does setting position: absolute on an element affect document flow?
Disrupts normal flow and does not affect the position of other elements on the page (they act like it’s not there)
How does setting position: absolute on an element affect where it appears on the page?
It will inherit it’s ancestor’s position
How do you constrain an absolutely positioned element to a containing block?
Set its position value to anything but static
What are the four box offset properties?
Top, Bottom, Left, Right
What are the four components of “the Cascade”.
Source Order, Specificity, Inheritance, !important
What does the term “source order” mean with respect to CSS?
The styling that comes lower in your stylesheet will take effect over the styling that is higher.