LFZ CSS Quiz Flashcards
What are the names of the individual pieces of a CSS rule?
Declarations
In CSS, how do you select elements by their class attribute?
.(name of class)
In CSS, how do you select elements by their type?
(name of element)
In CSS, how do you select an element by its id attribute?
(name of id)
What CSS properties make up the box model?
Margin, Border, Padding, Content
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 selector that specifies a special state of the selected element(s)
What are CSS pseudo-classes useful for?
Styling elements based on states or intractability
Name at least two units of type size in CSS.
em, pt, px, percent
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
What is the default value for the position property of HTML elements?
Static
How does setting position: relative on an element affect document flow?
once the positioned element has taken its place in the normal flow, you can then modify its final position
How does setting position: relative on an element affect where it appears on the page?
It appears like position: static, until you add some box offset properties.
How does setting position: absolute on an element affect document flow?
The element is removed from the document flow
How does setting position: absolute on an element affect where it appears on the page?
it is removed from the document flow and sits on top of everything.
How do you constrain an absolutely positioned element to a containing block?
set the containing element’s position property to anything except static
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 order that your CSS rules are written in your stylesheet. The styling provided for an element last in your stylesheet is the styling that will ultimately take effect.
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
set the property’s value to inherit.
List the three selector types in order of increasing specificity.
element selector, class selector, id selector
Why is using !important considered bad practice?
Because it makes debugging harder as it disrupts the natural order of the “Cascade”
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
The transition property is shorthand for which four CSS properties?
transition-property, transition-duration, transition-timing-function, and transition-delay
What is a breakpoint in responsive Web design?
The point at which the page changes
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?
changes in the width of the browser scale with the percentage
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 rules created lower in the code override higher ones