CSS Flashcards
What are the names of the individual pieces of a CSS rule?
Selector {
Property: Value
}
In CSS, how do you select elements by their class attribute?
.classname
In CSS, how do you select elements by their type?
element name
In CSS, how do you select an element by its id attribute?
idname
Name three different types of values you can use to specify colors in CSS.
Hexcode, RGB, RGBA, Color name
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?
Specifies a special state of an element
What are CSS pseudo-classes useful for?
To be more direct and efficient
Name at least two units of type size in CSS.
px 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?
No wrap
Why do two div elements “vertically stack” on one another by default?
They’re block elements
What is the default flex-direction of an element with display: flex?
Row
What is the default value for the position property of HTML elements?
Static
How does setting position: relative on an element affect document flow?
Does not affect document flow
How does setting position: relative on an element affect where it appears on the page?
” “
How does setting position: absolute on an element affect document flow?
It is removed from the document flow entirely
How does setting position: absolute on an element affect where it appears on the page?
” “
How do you constrain an absolutely positioned element to a containing block?
Position relative
What are the four box offset properties?
Top, Bottom, Left and 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?
Multiple rules that were to affect the same element the last rule would apply
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
Inheritance where child can use styling from parent elements if it hast been used
List the three selector types in order of increasing specificity.
Type, Class, ID
Why is using !important considered bad practice?
No reason to use it when there are selector types to use
What does the transform property do?
It modifies the coordinate space of the CSS
Give four examples of CSS transform functions.
Rotate, Scale, Translate, Skew
The transition property is shorthand for which four CSS properties?
transition-property , transition-duration , transition-timing-function , and transition-delay
Give two examples of media features that you can query in an @media rule.
min-width,max-height
Which HTML meta tag is used in mobile-responsive web pages?
Viewport
What is a breakpoint in responsive Web design?
When the content and design starts to adapt in a certain to fit the user experience
What is the advantage of using a percentage (e.g. 50%) width instead of a fixed (e.g. px) width for a “column” class in a responsive layout?
Adapts to exact dimensions of page
If you introduce CSS rules for a smaller min-width after the styles for a larger min-width in your style sheet, the CSS rules for the smaller min-width will “win”. Why is that?
Bottom would win cause of source order