CSS Flashcards
What are the names of the individual pieces of a CSS rule?
- Selector
- Declaration Block
- Declaration (Property: Value)
In CSS, how do you select elements by their class attribute?
.class
In CSS, how do you select elements by their type?
Using HTML element name.
In CSS, how do you select an element by its id attribute?
id
What is a pseudo-class?
A keyword added to a selector that specified a special state of the selected element(s).
What are CSS pseudo-classes useful for?
Add styling based on an element’s state.
What is the default value for the position property of HTML elements?
Static - Elements are im order. as they appear in the document flow.
How does setting position: relative on an element affect where it appears on the page?
The elements is positioned relative to its normal position.
How does setting position: absolute on an element affect document flow?
The element is taken out of normal flow and no longer affects the position of other elements on the page.
How does setting position: absolute on an element affect where it appears on the page?
The element will appear in its first positioned ancestor element that doesn’t have a value of static.
How do you constrain an absolutely positioned element to a containing block?
Using position: other than static on the containing block.
What are the four box-offset properties?
- Top
- Right
- Bottom
- Left
Why do two div elements “vertically stack” on one another by default?
• They are block-level elements.
What is the default flex-direction of an element with display: flex?
Row
Name at least two units of type size in CSS.
- Pixels
- Em
- Percentage