CSS Flashcards
What are the names of the individual pieces of a CSS rule?
CSS Selectors
In CSS. how do you select elements by their CLASS attribute?
Use a . before name of the class
example: .class-name { }
In CSS. how do you select elements by their type?
Use the name of the element followed by the curly braces
example: body { }
In CSS, how do you select an element by its ID attribute?
Use a # before the name of the ID
example: #id-name { }
Name three different types of values you can use to specify colors in CSS:
RGB Values, Hex Codes, Color Names
RGB, RGBA, HSL, HSLA
What CSS properties make up the box model?
Margin, Border, Padding, width, height
Which CSS property pushes boxes away from each other?
Margin Property
Which CSS property adds space between a box’s content and its border?
Padding Property
What is a psuedo-class?
a selector that selects elements that are in a specific state, i.e. they are the first element of their type, or they are being hovered by a mouse pointer.
What are CSS pseudo-classes useful for?
A pseudo-class is used to define a special state of an element.
For example, it can be used to:
- Style an element when a user mouses over it
- Style visited and unvisited links differently
- Style an element when it gets focus
Name two types of units that can be used to adjust font-size in CSS:
Pixels, percentages, ems, rems
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
What is the default flex-wrap of a flex container?
nowrap
Why do two div elements “vertically stack” on one another by default?
div is a block element and takes the full width of the content resulting in the divs stacking on one another.