CSS Flashcards
What are the names of the individual pieces of a CSS rule?
rule selector, declaration block, property, value,
if there is a function in the value, read as css function (name of element) with an argument of (name of argument
In CSS, how do you select elements by their class attribute?
.class name
In CSS, how do you select elements by their type?
just name of the element
In CSS, how do you select an element by its id attribute?
(pound sign).name of id
Name three different types of values you can use to specify colors in CSS.
RGB values, hex codes, and color name
What CSS properties make up the box model?
border, margin, padding
Which CSS property pushes boxes away from each other?
margin
Which CSS property add space between a box’s content and its border?
padding
Name two types of units that can be used to adjust font-size in CSS.
pixels, REM, etc (EMS, percentage)
What CSS property controls the font used for the text inside an element?
font-family
What is a pseudo-class?
a selector that selects elements that are in a specific state
(:hover, :nth-child(), etc)
What are CSS pseudo-classes useful for?
for developers, it is useful when there are repetitive works in css and give web visitors more convenience.
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 element which takes full block
What is the default flex-direction of an element with display: flex?
left to right (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?
act like a normal flow but allow you to position of the elements
How does setting position: relative on an element affect where it appears on the page?
lay on exact same spot if no box offset
How does setting position: absolute on an element affect document flow?
it becomes independent from the other relative position
no longer a normal flow
How does setting position: absolute on an element affect where it appears on the page?
if no box offset, top left corner of the ancestor element
How do you constrain an absolutely positioned element to a containing block?
have relative position as a parent of the block (not static)
What are the four box offset properties?
top, bottom, right, left