CSS Flashcards
What are the names of the individual pieces of a CSS rule?
one or more selectors, and a declaration block in curbraces, containing property/value pairs separated by semi-colons
- selector
- ruleset
- property/value pairs
In CSS, how do you select elements by their class attribute?
with .classname selector
In CSS, how do you select elements by their type?
with the element’s name
In CSS, how do you select an element by its id attribute?
with #idname selector
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?
- margin
- padding
- border
- content
Which CSS property pushes boxes away from each other?
margin
Which CSS property add space between a box’s content and its border?
padding
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) (can be a user-prompted state or a passive relational state). ex: :hover, :focus, :playing, :visited, :nth-child(odd)
What are CSS pseudo-classes useful for?
- user feedback, allows changing of elements as user interacts with them
- responding to changing states of elements on the site
- selecting elements by various relationships, types, states
Name two types of units that can be used to adjust font-size in CSS.
- pixels, percentages, and ems (width of letter m)
- - rem (based on font size of root html element)
What CSS property controls the font used for the text inside an element?
font-family:
What are the four components of “the Cascade”
in decreasing order:
- 1 !importance
- 2 specificity
- 3 source order
- 4 inheritance
What does the term “source order” mean with respect to CSS?
–the order rules are written and read in CSS
Source order is, simply put, the order that your CSS rules are written in your stylesheet.
“…in a specificity tie, the last rule defined wins.”
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
inheritance
List the three selector types in order of increasing specificity.
- type selectors
- class selectors
- ID selectors