css Flashcards
What are the names of the individual pieces of a CSS rule?
declaration block, properties, selector.
In CSS, how do you select elements by their class attribute?
.
In CSS, how do you select elements by their type?
their tags
In CSS, how do you select an element by its id attribute.
#
Name three different types of values you can use to specify colors in CSS.
RGB values, Hex Codes, named colors.
What CSS properties make up the box model?
margin padding border
Which CSS property pushes boxes away from each other?
margin
Which CSS property add space between a box’s content and it’s border?
padding
What is a pseudo class?
A pseudo class is a keyword that specifies a special state of an element.
What are pseudo-classes useful for?
They are useful for applying styling to elements when certain conditions are met, for example, hovering over a button.
Name at least two units of type size in CSS
px, rem
What CSS property controls the font used for text inside the element?
font-family
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?
It does not affect document flow for other elements.
How does setting position: relative on an element affect where it appears on the page?
It changes it’s position relative to where it would have been in static flow.
How does setting position: absolute on an element affect document flow?
It is treated as if it does not exist in document flow.
How does setting position: absolute on an element affect where it appears on the page?
It positions itself relative to the nearest non static element on the page according to its positional CSS properties.
How do you constrain an absolutely positioned element to a containing block?
You set one of it’s parent elements to a position other than static, and absolute.
What are the four box offset properties?
top, bottom, left, right
What does the term source order mean with respect to CSS?
The order rule sets and properties appear on a page
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
inheritence
List the three selector types in order of increasing specificity.
universal selector class selector id selector