CSS Flashcards
What are the names of the individual pieces of a CSS rule?
css declarations:
selector { declaration }
declaration consists of {property: value}
In CSS, how do you select elements by their class attribute?
.classname { }
In CSS, how do you select elements by their type?
elementname { ]
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.
rgb values
ex: rgb (200, 200,200)
hex codes
ex: #ee3e80
colors names
ex: white
hsl
ex: hsl(hue, saturation, lightness)
What CSS properties make up the box model?
- Content
- Padding: distance between inside content and border
- Border
- Margin: space between border and outside edge of the element
Which CSS property pushes boxes away from each other?
margin
What is a pseudo-class?
a keyword added to a selector that specifies a special state of the selected element(s)
What are CSS pseudo-classes useful for?
allows us to apply style to an element in relation to external factors, like the history of the navigator (:visited), the status of its content(:, or position of the mouse (:hover)
What are CSS pseudo-classes useful for?
allows us to apply style to an element in relation to external factors, like the history of the navigator (:visited), the status of its content, or position of the mouse (:hover)
extended functionality
Name two types of units that can be used to adjust font-size in CSS.
px - pixels
% - percentages
em - width of a letter m
What CSS property controls the font used for the text inside an element?
font or font-family
What are the four components of “the Cascade”.
source order
inheritance
specificity
important
What does the term “source order” mean with respect to CSS?
prioritizing the bottom properties, as styles.css is read from top to bottom
Why is using !important considered bad practice?
you can end up in a weird place where everything is important, so nothing is important. it just gets too confusing