CSS Flashcards
What are the names of the individual pieces of a CSS rule?
selector (selector group)and declaration block
In CSS, how do you select elements by their class attribute?
a dot follow by the value of the class attribute
In CSS, how do you select elements by their type?
just type the element name
In CSS, how do you select an element by its id attribute?
a # pound sign followed by the value of the id attribute
Name three different types of values you can use to specify colors in CSS.
Color names, RGB values, and Hex codes. (also HSL functional notation)
What is a pseudo-class?
A CSS pseudo-class is a keyword added to a selector which allows you to apply a style or functionality to the element when a user interacts with it.
What are CSS pseudo-classes useful for?
Links, buttons, form controls.
What CSS properties make up the box model?
Margin, border and padding.
Which CSS property pushes boxes away from each other?
Margin.
Which CSS property add space between a box’s content and its border?
Padding.
Name at least two units of type size in CSS.
Pixels, % percentages, ems.
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 (all flex items will be on one line)
Why do two div elements “vertically stack” on one another by default?
Because div elements are block level element.
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 would still be in normal flow
How does setting position: relative on an element affect where it appears on the page?
It would take its place in the normal flow first, then the position can be changed by using top, bottom, left and right properties.
How does setting position: absolute on an element affect document flow?
The element will be taken out from the normal flow.
How does setting position: absolute on an element affect where it appears on the page?
It would appear on the top left of the parent container.
How do you constrain an absolutely positioned element to a containing block?
Set the position property of containing block anything other than static. (like absolute, relative, fixed, and sticky)
What are the four box offset properties?
Top, bottom, left and right.