CSS Flashcards
what are the names of the individual pieces of a CSS rule?
selector, declaration block, property, value
how do you select elements by their class attribute?
.class element
how do you select elements by their type?
element name {}
how do you select an element by its id attribute?
id element
Name three different types of values you can use to specify colors in CSS
RGB values, hex code, color name
rgb a , hsl , hsl a
what css properties make up the box model?
content(height, width), 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 css pseudo class is a keyword added to a selector that specifies a special state of the selected element. ex) :hover can be used to change a button’s color when the user’s pointer hovers over it.
what are css pseudo classes useful for?
Pseudo classes let you apply a style to an element not only in relation to the content of the document tree, but also in relation to “external factors” like the history of the navigator(:visited), the status of its content(:checked), or position of the mouse (:hover)
Name two types of units that can be used to adjust font-size in CSS.
rem, px, em
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: left to right in ltr; right to left in rtl
what is the default ‘felx-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?
images default is set to full width .
what is the default flex-direction of an element with display:flex?
left to right (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 positioning moves an element in relation to where it would have been in normal flow.
How does setting ‘position: relative’ on an element affect where it appears on the page?
After indicating that an element should be relatively positioned using the position property with a value of relative, you can use the offset properties to indicate how far to move the element from where it would have been in the normal flow (top right bottom left)
- exactly the same. now it’s just positioned.
How does setting ‘position:absolute’ on an element affect document flow?
The box is taken out of normal flow and no longer affects the position of other elements on the page. ( they act like it is not there )
- act like elements not exist. big sweeping change.
How does setting position:absolute on an element affect where it appears on the page?
moves the element to the element that is not static?
How do you constrain an absolutely positioned element to a containing block?
by using the value not static.
what are the four box offset properties?
top right bottom and left
what are the four components of “the Cascade”?
source order, specificity, inheritance, important rule