CSS Flashcards
(42 cards)
What are the names of the individual pieces of a CSS rule?
CSS rule consist of a selector and a declaration block
In CSS, how do you select elements by their class attribute?
With .class name
In CSS, how do you select elements by their type?
You write the name of the element as the selector
In CSS, how do you select an element by its id attribute?
With #id name
Name three different types of values you can use to specify colors in CSS.
RGB values, HEX codes, color names
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?
A pseudo-class is keywords that are added to a selector that specifies a special state of the selected elements
What are CSS pseudo-classes useful for?
They are useful in applying style to an element without having to additional classes
Name at least two units of type size in CSS
pixels, percentage, 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?
Row - horizontal
What is the default flex-wrap of a flex container?
No wrap
What is the default value for the position property of HTML elements?
Static - Normal Flow
How does setting position: relative on an element affect document flow?
You can shift element without affecting surrounding text and document flow
How does setting position: relative on an element affect where it appears on the page?
It stays where it is unless you shift it
How does setting position: absolute on an element affect document flow?
t’s removed from the document flow
How does setting position: absolute on an element affect where it appears on the page?
Find the boundary and look for a non-static position. Appears nearest non-static parent
How do you constrain an absolutely positioned element to a containing block?
Set up non-static position
What are the four box offset properties?
Top, bottom, left, right
What are the four components of “the Cascade”.
Source order, inheritance, specificity, !important
What does the term “source order” mean with respect to CSS?
Styling provided for an element last in your stylesheet gets priority
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
Through inheritance if no CSS for that property is directly declared on the child element.