CSS Flashcards
(36 cards)
What are the names of the individual pieces of a CSS rule?
There are selectors, properties, and values (which is the declaration block) and all together it is known as a CSS rule set.
In CSS, how do you select elements by their class attribute?
Using a “ . “ and then the value of the attribute, followed by a declaration block.
In CSS, how do you select elements by their type?
Using the given node name, followed by a declaration block.
In CSS, how do you select an element by its id attribute?
Using a “#” and then the value of the attribute, followed by a declaration block.
Name three different types of values you can use to specify colors in CSS.
RGB (red, green, blue) values, hex codes, and color names
What CSS properties make up the box model?
padding, border, margin, height, width
Which CSS property pushes boxes away from each other?
Margin controls the gap between boxes.
Which CSS property add space between a box’s content and its border?
The padding property allows you to specify how much space should appear between the content and its border.
What is a pseudo-class?
It is a keyword that can be added to a selector to change the appearance of an element with a specific action like :hover, :active, :focus.
What are CSS pseudo-classes useful for?
Useful for event-based styling and …
Name at least two units of type size in CSS.
Pixels, percentages, EMs
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?
It is from left to right.
What is the default flex-wrap of a flex container?
All flex items will be on one line. Its value is “nowrap”.
Why do two div elements “vertically stack” on one another by default?
Because they are block level elements.
What is the default flex-direction of an element with display: flex?
row, filling in from left to right
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 have an effect at first.
How does setting position: relative on an element affect where it appears on the page?
It sets it in relation to the relative position.
How does setting position: absolute on an element affect document flow?
It removes it from the document flow. It is almost like they do not exist in relation to the other content on the page.
How does setting position: absolute on an element affect where it appears on the page?
It is positioned relative to the body/container.
How do you constrain an absolutely positioned element to a containing block?
It is set to the a parent element that is non-static (relative).
What are the four box offset properties?
Top, bottom, left, right
What are the four components of “the Cascade”.
Source order, inheritance, specificity, and !important