CSS Flashcards
If there are two or more rules that apply to the same element, which rule takes precedence?
Last rule= The latter if selectors are identical.
Specificity= If one selector is more specific that another.
Important = !important is considered more important that other rules.
What are some properties inherited by child elements automatically?
Font color, font family
What are some properties not inherited by child elements automatically?
Background-color, border properties
How do you force inheritance onto a child element?
Use inherit as the value of a property.
Why use external style sheets?
All pages can share the same style sheet.
Easier editing.
When might you use CSS in the HTML document instead of its own file?
If you are creating a single page with little code just to keep everything together, however it is still considered best practice to create a separate file.
How does CSS treat each HTML element?
It treats it as though each element is inside its own box.
What do selectors allow you to do?
Target your rules at different elements.
What are the two parts of a declaration?
The properties of the element you want to change, and the values of those properties.
Where do CSS rules generally appear?
CSS rules generally appear in a separate document, but sometimes may appear within the HTML page.
Name three different types of values you can use to specify colors in CSS.
RGB values
HEX codes
Color names
HSLA
What is a grouped selector?
A grouped selector is when you have multiple selectors chosen to style.
What CSS properties make up the box model?
Content
Border
Margin
Padding
What CSS property pushes boxes away from each other?
Margin
Which CSS property add spaces between a box’s content and its border?
Padding
How does the overflow property work?
Hidden: Hides any extra content the box cannot contain
Scroll: Adds a scrollbar to the box so users can see the rest of the content.
What is a pseudo-class?
A secondary class used to select specific attributes of an element.
What are CSS pseudo-classes useful for?
Changing the appearance of elements under special circumstances
What does :hover do?
Changes the appearance when a user hovers over something with a mouse.
What does :active do?
This changes the appearance when the user activates a button or link.
What does :nth-child() do?
Matches elements based on their position in a group of siblings.
What does :nth-child() do?
Matches elements based on their position in a group of siblings.
Name some units of type size in CSS
pixels, percentages, ems, rem, vh, vw, pts, etc