CSS Flashcards
What are the names of the individual pieces of CSS rules
Selector and declaration
In CSS, how do you select elements by their class attribute?
.classname
In CSS, how do you select elements by their type?
Using the elements name
In CSS, how do you select elements by its id attribute?
idname
Name three different types of values you can use to specify colors in CSS
Rgb, hex codes, color names
What CSS properties make up the box model
Border, margin, padding, content
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?
** class applied by the browser A keyword added to a selector that specifies a special state of the selected element
What are CSS pseudo-classes useful for?
Useful to style elements based of their state alone or when the user interacts with the selected element on the page
Name at least two units of type size in CSS
px, rem, em
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
Nowrap
Why do two div elements vertically stack on one another by default?
They are block line elements
What is the default flex-direction of an element with display of 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
No effect on document flow
How does setting position: relative on and element affect where it appears on the page
It appears where it would in normal flow but can be positioned using box offset properties
How does setting position: absolute on an element affect document flow
It acts as if that element doesn’t exist and continues its normal flow without including that element
How does setting position: absolute on an element affect where it appears on the page
It will place it in the nearest non-static parent and positions itself there; if they can’t find themselves a non-static parent, they will position themselves in the viewport or html
How do you do train a n absolutely positioned element to a containing block?
Set it’s containing elements display to something other than static; needs to be non-static element
What are the four components of “the Cascade”.
source order, inheritance, specificity, !important
What does the term “source order” mean with respect to CSS?
the order your CSS rules are written in your stylesheet; the lower it is in the stylesheet, the stronger it is in the stylesheet