CSS Flashcards
What are the names of the individual pieces of a CSS rule?
○ ruleset: css selector, declaration block, declaration, property, and value
In CSS, how do you select elements by their class attribute?
○ .classname (with a dot)
In CSS, how do you select elements by their type?
○ typename (nothing additional)
In CSS, how do you select an element by its id attribute?
○ #idname (with a #)
Name three different types of values you can use to specify colors in CSS.
Color Keywords, RGB (Red Green Blue), and HSL (Hue Saturation Light)
What CSS properties make up the box model?
○ Margin -> Border -> Padding -> Content (width + height)
Which CSS property pushes boxes away from each other?
Margin (takes the higher margin value)
Which CSS property add space between a box’s content and its border?
Padding
What is a pseudo-class?
An implied class based off of a certain element’s state (i.e. hover).
What are CSS pseudo-classes useful for?
Changing styles based on what the user is doing or has done. Selecting a group of elements via a pattern to avoid creating new classes for each.
Name two types of units that can be used to adjust font-size in CSS.
px, pt, em, 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?
○ nowrap
• Why do two div elements “vertically stack” on one another by default?
○ They are block-level elements.