CSS Flashcards
What are the names of the individual pieces of a CSS rule?
Selector, declaration
In CSS, how do you select elements by their class attribute?
.element[attribute]
In CSS, how do you select elements by their type?
selector type
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
Hex, name, RGB
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?
A keyword added to a selector that specifies a state of the element
What are css pseudo-classes useful for?
They can apply style to different states of an element. For example, if a link has been visited, it can be changed color to indicate that its been clicked before.
Name at least 2 units of type size in CSS
em, px, rem
What CSS property controls the font used for the text inside an element?
font-family
What is the default flex-direction of a flex container?
row
What is the default flex-wrap of a flex container?
no wrap
Why do two div elements “vertically stack” on one another by default?
They are block elements and block elements start on new lines
What is the default flex-direction of an element with display: flex?
row
What is the default value for the position property of HTML elements?
static
How does setting position: relative on an element affect document flow?
Relative allows you to move the item in relation to normal flow.
How does setting position: relative on an element affect where it appears on the page?
if you want to move it 10 pixels up then set bottom to 10 px;
How does setting position: absolute n an element affect document flow?
The box is taken out of normal flow and no longer affects the position of other elements.
How does setting position: absolute on an element affect where it appears on the page?
The position will appear in relation to its containing elements
How do you constrain an absolutely positioned element to a containing block?
fixed positioning
What are the four box offset properties?
top, right, bottom, left
What are the four components of “the Cascade”.
source order, inheritance, specificity, and importance/cascade?