CSS Flashcards
What are the names of the individual pieces of a CSS rule?
first part is a selector
followed by opening curly brace of the declaration block
followed by the declaration (property then value)
followed by closing curly brace of the declaration block
In CSS, how do you select elements by their class attribute?
put a dot “.” in front of the class name when declaring the selector
In CSS, how do you select elements by their type?
put just the element name as the selector
In CSS, how do you select an element by its id attribute?
put a hash (#) symbol in front of the id
Name three different types of values you can use to specify colors in CSS.
RGB
hexcode
name of color
What CSS properties make up the box model?
Margin
border
padding
height
width
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 a pseudo-class?
a keyword added to a CSS selector that species a special state that the selector is in
What are CSS pseudo-classes useful for?
styling of elements in relation to external factors and in relation to the document tree
ie change appearance of elements when a user interacts with them
Name two types of units that can be used to adjust font-size in CSS.
px
em
percent (%)
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 (left to right)
What is the default flex-wrap of a flex container?
nowrap (meaning all flex items will try to be kept on one line)
Why do two div elements “vertically stack” on one another by default?
because they are block elements meaning they start on a new line and take up that entire line