CSS Flashcards
What are the names of the individual pieces of a CSS rule?
Selector { declaration (declaration has a property: value pair) }
In CSS, how do you select elements by their class attribute?
Use .classname
In CSS, how do you select elements by their tag name?
Write the list of tags you want to target separated by commas.
In CSS, how do you select an element by its id attribute?
idname
Name three different types of values you can use to specify colors in CSS.
Keywords, RGB Values (either as CSV or hexadecimal), and HSL (height, saturation, lightness)
What CSS properties make up the box model?
Margin, border, padding, content
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 box-sizing “border-box”?
This prevents the box from stretching beyond the size you want — instead shrinks content
True or False: Padding and margin are the preferred way to center content on the page.
False — they should only be used for small moves! (Like giving text in an input box space)
What is a pseudo-class?
Add style to selectors that only activate under certain conditions to change state or position
What are CSS pseudo-classes useful for?
Increasing usability of your webpage
Name two types of units that can be used to adjust font-size in CSS.
Px, em, rem, %
What CSS property controls the font used for the text inside an element?
Font-family
What is the different between rem and em?
rem is based on the root document size (1rem = 16px) but ‘em checks most direct parent