CSS Flashcards
What are the names of the individual pieces of a CSS rule?
Selector, declaration block, properties with values
In CSS, how do you select elements by their class attribute?
.name{}
In CSS, how do you select elements by their type?
Just-the-name{}
In CSS, how do you select an element by its id attribute?
name{}
Name three different types of values you can use to specify colors in CSS.
Rgb, hex, color names, hsl
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 adds space between a box’s content and its border?
Padding
What is a pseudo-class?
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
What are CSS pseudo-classes useful for?
Allow us to add more functionality on a webpage without using javascript.
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 at least two units of type size in CSS.
Pixel, rem, em, ch
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 (horizontal direction)
What is the default flex-wrap of a flex container?
No wrap
Why do two div elements “vertically stack” on one another by default?
Because they are block level
What is the default flex-direction of an element with display: flex?
Row
What is the default value for the position property of HTML elements?
Static
How does setting position: relative on an element affect document flow?
Does not affect the document
How does setting position: relative on an element affect where it appears on the page?
It does not affect where it appears on the page UNLESS you move it
How does setting position: absolute on an element affect document flow?
Takes an element out of the normal document flow
How does setting position: absolute on an element affect where it appears on the page?
The location is based on the element’s closest non-statically positioned ancestor.
How do you constrain an absolutely positioned element to a containing block?
You set a position other than static
What are the four box offset properties?
Top, bottom, right, left
What are the four components of “the Cascade”.
Transition, !important, animation, and normal