CSS Flashcards
What is the default value for the position property of HTML elements?
normal flow
How does setting position: relative on an element affect where it appears on the page?
Position of the element would now be relative to the original normal flow position
How does setting position: relative on an element affect document flow?
the space allotted for the original flow is maintained.
How does setting position: absolute on an element affect document flow?
the element is no longer part of the page
How does setting position: absolute on an element affect where it appears on the page?
it is positioned relative to the containing element
How do you constrain an absolutely positioned element to a containing block?
the containing block must be set to relative
Name three different types of values you can use to specify colors in CSS.
hex codes, RGB values, color names
What are the names of the individual pieces of a CSS rule?
css ruleset, css selector, declaration block, property-value pairs
In CSS, how do you select elements by their class attribute?
with a period eg .color
In CSS, how do you select elements by their type?
just list the element eg h1 {
In CSS, how do you select an element by its id attribute?
with a # eg #jonathan {
What CSS properties make up the box model?
Border
margin (distance between box and other object)
padding (space between the border of a box and any content created within it)
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 CSS pseudo-class is a keyword added to a selector that specifies a special state of the selected element(s).
What are CSS pseudo-classes useful for?
Changing the appearance of elements when users interact with them.
Name two types of units that can be used to adjust font-size in CSS.
EM, PX
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 are block level elements
What is the default flex-direction of an element with display: flex?
row
What are the four components of “the Cascade”.
source order
inheritance
specificity
!important
What does the term “source order” mean with respect to CSS?
the order that your CSS rules are written in your stylesheet
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 selectors (least specific) class selectors id selectors (most specific)
Why is using !important considered bad practice?
it makes debugging more difficult by breaking the natural cascading
What does the transform property do?
The transform CSS property lets you rotate, scale, skew, or translate an element. It modifies the coordinate space of the CSS visual formatting model.
Give four examples of CSS transform functions.
matrix translate scale rotate skew
The transition property is shorthand for which four CSS properties?
The transition CSS property is a shorthand property for transition-property, transition-duration, transition-timing-function, and transition-delay.
Give two examples of media features that you can query in an @media rule.
color, device-width
Which HTML meta tag is used in mobile-responsive web pages?
viewport meta tag
What is a breakpoint in responsive Web design?
the point at which a media query is introduced
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?
the value will always be half 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?
source order