CSS Flashcards
What are the names of the individual pieces of a CSS rule?
Selector and Declaration
Name three different types of values you can use to specify colors in CSS.
RGB Values, Hex Codes, Color Names
What CSS properties make up the box model?
border, margin, and padding
What is a pseudo-class?
A selector that attracts elements in special state such as hover or focus. It is something the browser does.
What are CSS pseudo-classes useful for?
Let us write less code for styling.
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?
horizontal
What is the default flex-wrap of a flex container?
nowrap, all items will try to fit on one line
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?
It moves the item it was applied to, but doesn’t affect the rest of the document flow.
How does setting position: relative on an element affect where it appears on the page?
It makes the element get positioned relative to where it would be in the normal document flow.
How does setting position: absolute on an element affect document flow?
Surrounding elements ignore the space the absolute positioned element would have taken up. The absolute item no longer has a place in the document flow.
How does setting position: absolute on an element affect where it appears on the page?
The element is placed relative to where it is in its containing element, so make sure the containing element is set to relative also. It will go back to the first HTML element that is not static.
How do you constrain an absolutely positioned element to a containing block?
set position of containing element relative to the current element
What are the four box offset properties?
top, right, bottom, left
What are the four components of “the Cascade”.
Source Order, Inheritance, Specificity, & !important
What does the term “source order” mean with respect to CSS?
Source order is, simply put, the order that your CSS rules are written in your stylesheet. The styling provided for an element last in your stylesheet is the styling that will ultimately take effect.
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
Inheritance is the process by which certain CSS properties on a child HTML element can receive value from a parent element, if no CSS for that property is directly declared on the child element.
List the three selector types in order of increasing specificity.
Type, Class, ID
Why is using !important considered bad practice?
It causes issues with debugging by breaking the natural cascade of style sheet
What is a breakpoint in responsive Web design?
The points at which a media query is introduced are known as breakpoints.