CSS Flashcards
What are the names of the individual pieces of a CSS rule?
Selector, declaration block, properties
In CSS, how do you select elements by their class attribute?
By including a . before the selector
In CSS, how do you select elements by their type?
By using the element names
In CSS, how do you select an element by its id attribute?
By including a # before the selector
Name three different types of values you can use to specify colors in CSS.
RGB, Hex and Color names
What CSS properties make up the box model?
Border, margin and padding
Which CSS property pushes boxes away from each other?
Margin
Which CSS property adds space between a box’s content and its border?
Padding
What is a pseudo-class? A class applied to an element by the browser in a special circumstance.
They can change the appearance of elements when users are interacting with them
What are CSS pseudo-classes useful for?
Applying styling based on user actions. Style to an element in relation to the content to the document tree and other like the history (visited), status (checked) or position (hover)
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?
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?
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
How does setting position: relative on an element affect where it appears on the page?
Move it in relation to where it would have been on the page
How does setting position: absolute on an element affect document flow?
Does affect
How does setting position: absolute on an element affect where it appears on the page?
It is removed from the document flow entirely
How do you constrain an absolutely positioned element to a containing block?
Using position: relative
What are the four box offset properties?
Top, right, bottom, left
What are the four components of “the Cascade”.
Source order, Inheritance, Specificity and !important
What does the term “source order” mean with respect to CSS?
The last css rule set in your stylesheet will be applied
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
Using inheritable properties
List the three selector types in order of increasing specificity.
It makes debugging more difficult
List the three selector types in order of increasing specificity.
It overrides specificity and it makes debugging more difficult
What does the transform property do?
Rotates, scale, skew or translate the object
Give four examples of CSS transform functions.
Translate, rotate, skew, scale
The transition property is shorthand for which four CSS properties?
Transition-delay, transition-duration, transition-property, transition-timing-function
Give two examples of media features that you can query in an @media rule.
Min-width, max-width
Which HTML meta tag is used in mobile-responsive web pages?
Viewport meta tag
What is a breakpoint in responsive Web design?
The points at which the width of the viewport changes (where @media is applied)
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?
It sizes accordingly to the width of the screen
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?
Because of source order