CSS Flashcards
what are the names of the individual pieces of a css rule?
selector, declaration
in css, how do you select elements by their class attribute?
.className
in css, how do you select elements by their type?
the name of the element
in css, how do you select an element by its id attribute?
IDname
name 3 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?
margin, padding, border
which css property pushes boxes away from each other?
margin
which css property adds space between a box’s content and its border?
padding
what is a pseudo-class?
specifies a special state of the selected element
what are css pseudo-classes useful for?
changing styles based on user interaction
name at least two units of type size in css
pixels, 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
divs 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 on element affect document flow?
doesn’t move other elements
how does setting position:relative on an element affect where it appears on a page?
appears in relation to its original position
how does setting position:absolute on an element affect where it appears on a page?
it is positioned within the first non-static ancestor.
how do you constrain an absolutely positioned element to a containing block?
by setting the block position to anything other than static.
what are the 4 offset properties?
top, bottom, left, right
what are the 4 components of “the cascade”?
source order, inheritance, specificity & !important
what does the term ‘source order’ mean with respect to css?
the order in which css rules are written. last styling for an element will 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?
certain properties are automatically inherited by child elements. mostly font properties
list 3 selector types in order of increasing specificity
type selector, class selector, id selector
why is using !important considered bad?
makes debugging more difficult by breaking the natural cascading in the stylesheet
what does the transform property do?
modifies the coordinate space of the css visual formatting model.
give 4 examples of css transform functions
rotate, scale, skew, translate
the transition property is shorthand for which 4 css properties?
transition-property, transition-duration, transition-timing-function, and transition-delay
give 2 examples of media features that you can query in an @media rule
min-width, max-width
which html meta tag is used in mobile responsive web pages?
viewport
what is a breakpoint in responsive web design?
the point at which a media query is introduced
what is the advantage of using percentage width instead of a fixed width for a column class in a responsive layout?
flexible, will shrink and grow with the browser.