CSS Flashcards
What are the names of the individual pieces of a CSS rule? Describe the syntax.
Selector / Declaration block made up of Properties / Values
Selector followed by an opening curly brace.
Property, colon, value, semicolon. You can add as many properties and values you want to one rule. End the rule for that selector with the closing curly brace.
In CSS, how do you select elements by their type?
Element-type-name { }
EX: body { } - this selects the body element
in CSS, how do you select an element by its id attribute?
id-name { }
In CSS, how do you select elements by their class attribute?
.note { }
This will select any element whose class attribute has a value of “note”
What is a Universal Selector?
- { } - This targets all elements on the page
In CSS how do you select an element that is a child of another element?
li > a { } - This targets any < a > elements that are children of an < li > element (but not other < a > elements in the page and not the < li > element itself)
Name 3 different types of values you can use to specify colors in CSS
RGB Values (values for red, green, and blue are expressed as numbers between 0 and 255)
Hex Codes (Hex values represent values for red, green, and blue in a hexadecimal code)
Color Names (colors are represented by predefined names, however they are very limited in number)
What CSS properties make up the box model?
Margin, Border, Padding, 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). For example :hover can be used to change a buttons color when the user’s pointer hovers over it.
What are CSS pseudo-classes useful for?
Pseudo-classes allow you to change the styling/ appearance of elements when a user is interacting with them.
Name at least 2 units of type size in CSS
Pixels (px), Percentages(%), Ems (em), REM
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