CSS Flashcards
What are the names of the individual pieces of a CSS rule?
selector, declaration, inside the declaration block, there are properties and values.
In CSS, how do you select elements by their class attribute?
using the dot notation in front of the selector name.
In CSS, how do you select elements by their type?
using element name
In CSS, how do you select an element by its id attribute?
using hash notation in front of the selector name.
Name three different types of values you can use to specify colors in CSS.
RGB Values, Hex Codes, Color Names
What CSS properties make up the box model?
content, padding, border, margin
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 keyword added to a selector that specifies a special state of the selected element(s). classes applied by the browser under special circumstances.
What are CSS pseudo-classes useful for?
Pseudo-classes let you apply a style to an element under specific circumstances. apply styling as a result of user interaction.
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?
no wrap
Why do two div elements “vertically stack” on one another by default?
because div is a block level element.
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?
normal document flow, other neighboring elements will stay the same. once the positioned element has taken its place in the normal flow, you can then modify its final position, including making it overlap other elements on the page.
How does setting position relative on an element affect where it appears on the page?
stays the same until top, right, bottom, left properties to modify the elements position.
How does setting position absolute on an element affect document flow?
not part of normal document flow and no space is created for the element in the page layout. It sits on its own layer separate from everything else.
How does setting position absolute on an element affect where it appears on the page?
It is positioned relative to its closest positioned ancestor, otherwise, it is placed relative to the initial containing block.
How do you constrain an absolutely positioned element to a containing block?
set its ancestor to any other position than static.
What are the four box offset properties?
top, right, bottom, left
What are the four components of “the Cascade”.
source order, specificity, inheritance, important.