css Flashcards
(34 cards)
What are the names of the individual pieces of a CSS rule?
css selector and declaration / property and value
In CSS, how do you select elements by their class attribute?
with a . followed by class name
In CSS, how do you select elements by their type?
by simply typing the type name followed by the declaration
In CSS, how do you select an element by its id attribute?
with a # followed by ID name
Name three different types of values you can use to specify colors in CSS.
Hex code, RDB, 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 adds space between a box’s content and its border?
padding
What is a pseudo-class?
a keyword that defines a special state of an element such as hover and focus
What are CSS pseudo-classes useful for?
changing the style of an element under a certain condition. EX: when mouse hovers button, change background to a different color.
Name at least two units of type size in CSS.
pixels, rem, em, and percentages
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 they are block level 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?
it does not affect content flow.
How does setting position: relative on an element affect where it appears on the page?
the element stays the same.
How does setting position: absolute on an element affect document flow?
Absolute pulls the element out of the normal flow and all other content ignores the elements existence
How does setting position: absolute on an element affect where it appears on the page?
the element will appear at the top left of its first not-static parent element
How do you constrain an absolutely positioned element to a containing block?
by setting the containing block to position: relative and using the four box offset properties to position it relative to the containing block
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