CSS Flashcards
What are the names of the individual pieces of a CSS rule?
Selector, Declaration Block, Properties, Values (all together they are called a “rule set”)
In CSS, how do you select elements by theirclassattribute?
.classname
In CSS, how do you select elements by their type?
the element name
In CSS, how do you select an element by itsidattribute?
#
Name three different types of values you can use to specify colors in CSS.
RBG values, Hex codes, Color Names
What CSS properties make up the box model?
Padding, Margin, Border, Width and Height
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(s). For example, :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, for example), the status of its content (like :checked on certain form elements), or the position of the mouse (like :hover, which lets you know if the mouse is over an element or not).
Name two types of units that can be used to adjustfont-sizein CSS.
px, em, %
What CSS property controls the font used for the text inside an element?
font-family
What is the defaultflex-directionof aflexcontainer?
Row
What is the defaultflex-wrapof aflexcontainer?
no-wrap
Why do two div elements “vertically stack” on one another by default?
They are Block elements
What is the defaultflex-directionof an element withdisplay: flex?
Row
What is thedefaultvalue for thepositionproperty of HTML elements?
Static
How does settingposition: relativeon an element affect document flow?
It doesn’t not affect the elements around it
how does settingposition: relativeon an element affect where it appears on the page?
normal
How does settingposition: absoluteon an element affect document flow?
removed entirely. other elements act like its not there
How does settingposition: absoluteon an element affect where it appears on the page?
it is removed from the document flow and appears in relation to its containing element
How do you constrain an absolutely positioned element to a containing block?
setting an ancestor element to something other than static
What are the four box offset properties?
top bottom left and right
What are the four components of “the Cascade”.
Source Order, Inheritance, Specificity & !important