CSS Flashcards
(41 cards)
What are the names of the individual pieces of a CSS rule?
selector, declaration, curly brace, property, value
How do you select elements by their class attribute?
by adding a period in front:
.example {}
How do you select elements by their tag name?
just add the tag name
example {}
How do you select an element by its id attribute?
by adding a # in front:
#example {}
Name three different types of values you can use to specify colors in CSS.
the color name, rgb values, hexcodes
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?
pseudo-classes are keywords added next the the selector that specifies a special state of the selected element.
Give an example of a pseudo-class
button : hover {
background-color: blue;
}
this would change the color of the button if your cursor hovers over it.
:hover :active :focus are a few other ones
What are CSS pseudo-classes useful for?
it helps change an element when a specific action is taken
What does the :nth-child() pseudo class do?
an :nth-child() pseudo-class is used to specify between a group of siblings using their positions
Name the types of units that can be used to adjust font-size in CSS.
pixels(px), percentages, and ems(em)/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
Why do two div elements “vertically stack” on one another by default?
because they are block level elements so each div would separate from each other
What is the default flex-direction of an element with display: flex?
row
What are the three primary components of a page layout? (Which helper classes do you need?)
container, row, columns
flexbox
What is the minimum number of columns that you should put in a row?
one
What is the purpose of a container?
To hold the contents needed for the layout
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?
doesn’t really change the flow of the document but it moves the element
How does setting position: relative on an element affect where it appears on the page?
it moves an element in relation to where it would’ve been