CSS Flashcards
(38 cards)
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
What is a pseudo-class?
a class applied to a selector that specifies a special state of the selected element
What are CSS pseudo-classes useful for?
applying styling based on user actions not only in relation to the content of the document tree, but also in relation to external factors like the history of the navigator (:visited, for example), the status of its content (like :checked on certain form elements), or the position of the mouse
What are some examples of a pseudo-class?
:hover, :active, :focus, :link, :visited
Name at least two units of type size in CSS.
rem, px, pt
What CSS property controls the font used for the text inside an element?
font-family
What are the names of the individual pieces of a CSS rule?
selector {property: value}
…declaration = property:value
In CSS, how do you select elements by their class attribute?
.class-name {
property: value
}
In CSS, how do you select elements by their type?
p {
property: value
}
In CSS, how do you select an element by its id attribute?
#id-element { property: value }
Name three different types of values you can use to specify colors in CSS.
rgb/a, color keywords (black, red, blue, etc), hex codes
What is the default flex-direction of a flex container?
row
What is the default flex-wrap of a flex container?
nowrap (all flex items will be on one line)
Why do two div elements “vertically stack” on one another by default?
divs 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?
position: static
How does setting position: relative on an element affect document flow?
the element remains a part of the normal document flow
How does setting position: relative on an element affect where it appears on the page?
- relative positioning moves an element in relation to where it would have been in normal flow
- if there are no other elements, there would be no change to its movement
How does setting position: absolute on an element affect document flow?
the element is taken out of the document 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?
“top, bottom, left, and right” now tells us the distance the element should be from the containing element. rather than its relative position in the normal document flow
How do you constrain an absolutely positioned element to a containing block?
“position: relative” on the element and container
What are the four box offset properties?
top, bottom, left, right