CSS Flashcards
What are the names of the individual pieces of a CSS rule?
selector, declaration block, property, value
In CSS, how do you select elements by their class attribute?
.
In CSS, how do you select elements by their tag name?
just the name of the element 4head
In CSS, how do you select an element by its id attribute?
#
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).
What are CSS pseudo-classes useful for?
used to add styles to selectors, but only when those selectors meet certain conditions. A pseudo class is expressed by adding a colon (:) after a selector in CSS, followed by a pseudo-class such as “hover”, “focus”, or “active”, like this: a:hover { /* your style here */ }
Name two types of units that can be used to adjust font-size in CSS.
What CSS property controls the font used for the text inside an element?
font-family
Why do two div elements “vertically stack” on one another by default?
they’re block elements
What is the default flex-direction of an element with display: flex?
row
What are the three primary components of a page layout? (Which helper classes do you need?)
visual heirarchy, visual flow, grouping/alignment
What is the minimum number of columns that you should put in a row?
1
What is the purpose of a container?
easier to organize shiet
How does setting position: relative on an element affect where it appears on the page?
move relative to where it normally would exist if it was static
How does setting position: relative on an element affect document flow?
it has no affect on document flow
How does setting position: absolute on an element affect document flow?
it don’t
How do you constrain an absolutely positioned element to a containing block?
it goes to first non static ancestor
What are the four box offset properties?
How does setting position: absolute on an element affect where it appears on the page?
removed from document entirely, so it yolos. goes to nearest layer positioned
What are the four components of “the Cascade”.
order inheritance specificity !important
What does the term “source order” mean with respect to CSS?
whatevers on bottom of stylesheet reigns supreme
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
if its an inheritable rule
List the three selector types in order of increasing specificity.
no value -> type -> class/id
Why is using !important considered bad practice?
its lame and theres not really a way to future proof help u