CSS Flashcards
What are the names of the individual pieces of a CSS rule?
selector and declaration block- within block is a property assigned a value (separated by semicolon)
ex) p {color:red}
In CSS, how do you select elements by their class attribute?
class attribute is .classname
In CSS, how do you select elements by their type?
element name ex) h1, h2, body, p
In CSS, how do you select an element by its id attribute?
id attribute is #idname
Name three different types of values you can use to specify colors in CSS.
Hex code, rgb vaules, color names
What CSS properties make up the box model?
margin, padding, border, 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?
classes applied by the browser under certain conditions [keyword added to a selector for when a special event occurs (hover, focus, active)]
What are CSS pseudo-classes useful for?
apply style, user interaction
Name at least two units of type size in CSS.
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?
because 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?
moves element in relation to where it would be in a normal document flow
How does setting position: relative on an element affect where it appears on the page?
stays in same place unless value of top, bottom, left, right are changed
How does setting position: absolute on an element affect document flow?
taken out of flow, so other elements act as if its no longer there (on its own layer)
How does setting position: absolute on an element affect where it appears on the page?
sits on top of non-static ancestor (on its own layer)
How do you constrain an absolutely positioned element to a containing block?
it needs to be on an element without a static position
What are the four components of “the Cascade”.
source order, inheritance, specificity, !important
What does the term “source order” mean with respect to CSS?
the order that you put rulesets in your styling sheet
styling that come later supersedes other