CSS (Cascading Style Sheets) Flashcards
What are the names of the individual pieces of a CSS rule?
Selector, Declaration Block, Declaration (which contain property and value)
In CSS, how do you select elements by their class attribute?
.
In CSS, how do you select elements by their type?
the name
In CSS, how do you select an element by its id attribute?
#
Name three different types of values you can use to specify colors in CSS.
rgb values, hex code, and color name (most common 3)
What CSS properties make up the box model?
Padding, Border, Margin
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?
Classes applied by browser under certain circumstances
What are CSS pseudo-classes useful for?
Applied styling as a result of user interaction
Name at least two units of type size in CSS.
rem, px, %, pt
What is the default flex-direction of a flex container?
row - left to right
What is the default flex-wrap of a flex container?
nowrap
Why do two div elements “vertically stack” on one another by default?
They are block elements
What is the default flex-direction of an element with display: flex?
row - left to right
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 affects its normal document flow
How does setting position: relative on an element affect where it appears on the page?
It stays in the same location
How does setting position: absolute on an element affect document flow?
Disrupts normal flow and does not affect the position of other elements on the page (they act like it’s not there)
How does setting position: absolute on an element affect where it appears on the page?
It will inherit it’s ancestor’s position
How do you constrain an absolutely positioned element to a containing block?
Set its position value to anything but static
What are the four box offset properties?
Top, Bottom, Left, 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?
The styling that comes lower in your stylesheet will take effect over the styling that is higher.
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.
element –> class –> ID
Why is using !important considered bad practice?
It makes it more difficult to debug later on. There has to be a good reason why it’s being utilized.
What does the transform property do?
Property that lets you rotate, scale, skew, or translate an element.
Give four examples of CSS transform functions.
Scale, rotate, translate, matrix
The transition property is shorthand for which four CSS properties?
transition-property, transition-duration, transition-timing-function, transition-delay
Give two examples of media features that you can query in an @media rule.
min-width and 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 point where new styling is being 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?
Much more flexible, maintainable, and easy to use
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