CSS Flashcards
What are the names of the individual pieces of a CSS rule?
rule set, selector, property, value
In CSS, how do you select elements by their class attribute?
.
In CSS, how do you select elements by their type?
write the name of the element
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.
the name RGB and hexcodes.
What CSS properties make up the box model?
margin, border, padding, content
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 pseudo class is expressed by adding a colon (:) after a selector in CSS, followed by a pseudo-class such as “hover”, “focus”, or “active
What are CSS pseudo-classes useful for?
CSS pseudo-classes are used to add styles to selectors, but only when those selectors meet certain conditions
what is :nth-child()
The :nth-child() CSS pseudo-class matches elements based on their position in a group of siblings.
Name at least two units of type size in CSS.
percentage, 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?
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
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 doesn’t. relative positioning doesn’t affect the layout, the positioned element is still in its initial place
How does setting position: relative on an element affect where it appears on the page?
it appears relative to where it used to be
How does setting position: absolute on an element affect document flow?
An absolutely positioned element no longer exists in the normal document flow. Instead, it sits on its own layer separate from everything else.
How does setting position: absolute on an element affect where it appears on the page?
An element with position: absolute; is positioned relative to the nearest positioned ancestor
What are the four box offset properties?
top, bottom, left, right
What are the four components of “the Cascade”.
specificity, order important, source order, inheritance