CSS Flashcards
Name three different types of values you can use to specify colors in CSS.
RGB, Hexidecimal, Color name
What 5 CSS properties make up the box model?
Margin, Padding, Width, Height, Border
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 are the names of the individual pieces of a CSS rule?
Selector and a declaration
In CSS, how do you select elements by their class attribute?
by using a period ( . )
In CSS, how do you select elements by their type?
By typing the matching element name.
In CSS, how do you select an element by its id attribute?
By using a ( # ) symbol.
What is a pseudo-class?
a keyword added to a selector that specifies a special state of the selected element(s).
What are CSS pseudo-classes useful for?
pseudo-classes allow us to apply styling based on user interaction or the structure of the HTML document
Name two types of units that can be used to adjust font-size in CSS.
pixels, 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?
Because they are block-level 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?
it doesn’t affect the document flow
How does setting position: relative on an element affect where it appears on the page?
it sits right where it’s supposed to be. Like normal flow
How does setting position: absolute on an element affect document flow?
it is no longer a part of normal document flow
How does setting position: absolute on an element affect where it appears on the page?
it will appear at the top left corner of the nearest ancestor element that is not static
How do you constrain an absolutely positioned element to a containing block?
set position: not static;
What are the four box offset properties?
top, right, bottom, left
What does the term “source order” mean with respect to CSS?
the order that your CSS rules are written in your stylesheet.
List the three selector types in order of increasing specificity.
type, class, id
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
inheritance
Why is using !important considered bad practice?
it overrides everything / subverts the cascade
What are the four components of “the Cascade”.
source order, inheritance, specificity, !important
What does the transform property do?
The transform CSS property lets you rotate, scale, skew, or translate an element.
Give four examples of CSS transform functions.
translate, scale, rotate, skew
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?
meta viewport
What is a breakpoint in responsive Web design?
CSS breakpoints are points where the website content responds according to the device width
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?
Fixed values may not look the way you want them to in different circumstances
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 the CSS cascade
Which HTML meta tag is used in mobile-responsive web pages?
meta viewport
What is a breakpoint in responsive Web design?
the point at which the page changes / responds to expanding / contracting
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?
pixels are fixed, percentages are relative
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 the cascade / source order