CSS Flashcards
What are the names of the individual pieces of a CSS rule?
Selector, declaration block, properties
In CSS, how do you select elements by their class attribute?
By including a . before the selector
In CSS, how do you select elements by their type?
By using the element names
In CSS, how do you select an element by its id attribute?
By including a # before the selector
Name three different types of values you can use to specify colors in CSS.
RGB, Hex and Color names
What CSS properties make up the box model?
Border, margin and padding
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 class applied to an element by the browser in a special circumstance.
They can change the appearance of elements when users are interacting with them
What are CSS pseudo-classes useful for?
Applying styling based on user actions. Style to an element in relation to the content to the document tree and other like the history (visited), status (checked) or position (hover)
Name at least two units of type size in CSS.
Pixels, percentages, ems
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?
Because they are block elements
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
How does setting position: relative on an element affect where it appears on the page?
Move it in relation to where it would have been on the page
How does setting position: absolute on an element affect document flow?
Does affect
How does setting position: absolute on an element affect where it appears on the page?
It is removed from the document flow entirely
How do you constrain an absolutely positioned element to a containing block?
Using position: relative
What are the four box offset properties?
Top, right, bottom, left
What are the four components of “the Cascade”.
Source order, Inheritance, Specificity and !important