CSS Flashcards
What are the names of the individual pieces of a CSS ruleset?
- Selector
- Declaration (comprised of a property and its value)
In CSS, how do you select elements by their class attribute?
With the class selector
Ex. .note { } - targets any elements whose class attribute is note
In CSS, how do you select elements by their type?
You select the elements with their name and { }
Ex. h1 { } - this will select all h1 elements
In CSS, how do you select an element by its id attribute?
With the id selector #
Ex. #introduction - targets the element whose id attribute has the value of introduction
Name three different types of values you can use to specify colors in CSS.
- rgb value (red, green, blue)
- Values are expressed between 0 and 255
- Ex. rgb (102, 205, 170)
- hex codes
- has 6 characters
- Ex. #66cdaa
-color names
What CSS properties make up the box model?
Margin, padding, border, width, height
*Width & height = content of box
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?
Keywords added to a selector that specifies a special state of the selected elements
Ex. “ : hover “ can be used to change a button’s color when the user’s pointer hovers over it
What are CSS pseudo-classes useful for?
It is useful for applying styling to an element that is not only in relation to the content but also in relation to external factors (also good for visual and interactive purposes)
Name two types of units that can be used to adjust font-size in CSS.
Pixels, percentages, ems
What CSS property controls the font used for the text inside an element?
Font-family property
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 (all flex items will be on one line)
Why do two div elements “vertically stack” on one another by default?
They are block-line elements and block line elements start on new lines