CSS Flashcards
What are the names of the individual pieces of a CSS rule?
Selector, declaration block, declaration has property and value, and closing curly brace of the declaration block
In CSS, how do you select elements by their class attribute?
Use a period/dot before the class attribute
In CSS, how do you select elements by their tag name?
Just write the tag name, like body, h1, article
In CSS, how do you select an element by its id attribute?
Use # before the id attribute
Name three different types of values you can use to specify colors in CSS.
RGB values, Hex codes, color names
Ex. rgb(102, 205, 170) hex code (#66cdaa), color name (MediumAquaMarine)
What CSS properties make up the box model?
Content(width & height), 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?
It’s a class that changes the appearance when the user is interacting with it.
Ex. hovering over a button, cursor changing when hovering, or active (actively clicking and holding down mouse), focus (when browser knows you are ready to interact with the element like when cursor is in a form input ready to accept typing), visited, link, disabled
What are CSS pseudo-classes useful for?
It helps distinguish the actions a user can interact with or has already interacted with.
Ex. the link can change colors depending on if it was already visited or if it’s about to be clicked aka hovering.
Name two types of units that can be used to adjust font-size in CSS.
Px, rem(can use quarter sizes, 1.25, 1.5 etc), ems, %
What CSS property controls the font used for the text inside an element?
Font-size, font-family, font-weight, font-style, text-transform, text-decoration
What is the default flex-direction of a flex container?
Row/horizontal
What is the default flex-wrap of a flex container?
no-wrap.
tries to fit everything into 1 line, which may cause container to overflow.
Why do two div elements “vertically stack” on one another by default?
Because they are default block element