CSS Flashcards
What are the names of the individual pieces of a CSS rule?
Start of a new CSS rule set:
[selector] { start of declaration block
property : value ;
} end of declaration block
In CSS, how do you select elements by their class attribute?
To select an element by their class attribute you preface the class name with a .
In CSS, how do you select elements by their tag name?
To select an element by its tag name you just use the tag name as the selector
In CSS, how do you select an element by its id attribute?
To select an element by their id attribute you preface the id name with a #
Name three different types of values you can use to specify colors in CSS.
Color Name - e.g. White, Black, Blue
Hex Code - e.g. #ffffff
RGB Value - e.g. rgb(255 255 255);
What CSS properties make up the box model?
The content (length and width)
Padding (space between content and border)
Border
Margin (space between border and other boxes)
Which CSS property pushes boxes away from each other?
The margin property
Which CSS property add space between a box’s content and its border?
The padding property
What is a pseudo-class?
A pseudo class is a keyword added to selector that specifies a special state of the selected element. Pseudo-classes let you apply a style to an element not only in relation to the content of the document tree, but also in relation to external factors e.g. :hover (when element is hovered) :active (when the element is in use such as a click)
What are CSS pseudo-classes useful for?
CSS pseudo-classes are useful for providing feedback to the user (e.g. form elements [buttons active/inactive states] or hyperlinks [visited or not])
Name two types of units that can be used to adjust font-size in CSS.
Pixels (px), Ems (em), and percentages (%)
What CSS property controls the font used for the text inside an element?
Font-family property
What is the default flex-direction of a flex container?
The default flex-direction of a flex container is row
What is the default flex-wrap of a flex container?
The default flex-wrap of a flex container is no-wrap
Why do two div elements “vertically stack” on one another by default?
Divs are block elements which do not allow any other elements to be on the same line as them.