CSS Flashcards
What are the names of the individual pieces of a CSS rule?
Selector, then curly braces which contain declaration (property and value)
In CSS, how do you select elements by their class attribute?
dot followed by the class name, then curly braces for ruleset block
In CSS, how do you select elements by their type?
- just the name of the element itself
- e.g. body, h1, p, etc. followed by curly braces for ruleset block
In CSS, how do you select an element by its id attribute?
symbol and then name of id, then curly braces for ruleset block
Name three different types of values you can use to specify colors in CSS
rgb, hex code, 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
What is a pseudo-class?
keyword added to selector that specifies a special state of the selected element
( e.g. :hover )
Class being applied to an element by the browser for a specific interaction
What are CSS pseudo-classes useful for?
- useful for hovering over buttons, focusing on an element
- applying styling based on user actions or reducing number of classes applied to elements by using pseudo-classes for the html structure
Name at least two units of type size in CSS
- Pixels, percentages, etc.
- example: px, %, rem
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;
all items will be on one line
Why do two div elements “vertically stack” on one another by default?
because a div element is a block