CSS Flashcards
What are the names of the individual pieces of a CSS rule?
CSS selector, declaration block, properties, values
In CSS, how do you select elements by their class attribute?
’.’
In CSS, how do you select elements by their type?
Use its name
In CSS, how do you select an element by its id attribute?
Use a ‘#’
Name three different types of values you can use to specify colors in CSS.
keyword, rgb function, hex representation
What CSS properties make up the box model?
margin, border, padding, width, height
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 special state of an element
What are CSS pseudo-classes useful for?
Highlighting an element when the user interacts with it
Name at least two units of type size in CSS.
px, 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?
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?
left to right
What are the four components of “the Cascade”?
source order, specificity, inheritance, important
What does the term “source order” mean with respect to CSS?
Last rule of the same specificity gets applied.
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
inheritance
List the three selector types in order of increasing specificity.
type, class, id
Why is using !important considered bad practice?
Goes against the grain of cascade. Makes rules hard to reuse.
What does the transform property do?
Rotates, scales, skews, or translates an element
Give four examples of CSS transform functions.
matrix, rotate, scale, skew
Give two examples of media features that you can query in an @media rule.
width, min-width, max-width
Which HTML meta tag is used in mobile-responsive web pages?
name =”viewport” content=”width-device-width, initial-scale=1.0”
What is a breakpoint in responsive Web design?
The point where it breaks to a new form of styling to accommodate varying screen size.
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?
Percentage will adjust as the screen width changes
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?
The one that’s lower will take effect because of source order.