CSS Flashcards
What are the names of the individual pieces of a CSS rule?
type of selector, curly brace, decoration block (property and value)
In CSS, how do you select elements by their class attribute?
.class name {
In CSS, how do you select elements by their type?
input[type=attribute name] {
In CSS, how do you select an element by its id attribute?
name of id {
Name three different types of values you can use to specify colors in CSS.
RGB values, hex codes, and color names.
What CSS properties make up the box model?
Borders, margins, paddings, and the actual content.
Which CSS property pushes boxes away from each other?
Margin. It is an invisible space around your box and this pushes other elements away from the box.
Which CSS property adds space between a box’s content and its border?
Padding. It is the space between the content of an element and the border of that same element.
What is a pseudo-class?
It provides a special state of the selected element to the specified selector.
What are CSS pseudo-classes useful for?
It’s useful when you want to give action to a specified selector, such as styling links or responding to users.
Name at least two units of type size in CSS.
Px (pixels), rem (root element).
What CSS property controls the font used for the text inside an element?
The 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 elements.
What is the default flex-direction of an element with display: flex?
It displays in a row.
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?
It doesn’t affect the document flow if there is no value for the property.
How does setting position: relative on an element affect where it appears on the page?
It could be displaced visually by top, right, bottom, left offsets properties.
How does setting position: absolute on an element affect document flow?
It no longer exists in the normal document flow. It has its own layer and separates it from everything else.
How does setting position: absolute on an element affect where it appears on the page?
It shows an isolated element that doesn’t interfere with other elements on the page.
How do you constrain an absolutely positioned element to a containing block?
Put absolute position inside of relative position.
What are the four box offset properties?
Top, right, bottom, left.
What are four components of “the Cascade”.
Importance, source order, inheritance, specificity.