CSS Flashcards
What are the names of the individual pieces of a CSS rule?
Selector, declaration block (property, value)
In CSS, how do you select elements by their class attribute?
.className
In CSS, how do you select elements by their type?
element name
In CSS, how do you select an element by its id attribute?
idName
Name three different types of values you can use to specify colors in CSS.
RGB Values, Hex Code, Color Name
What CSS properties make up the box model?
Border, Margin, Padding,
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 the browser in certain circumstances.
What are CSS pseudo-classes useful for?
Adding style to an element based on user behavior.
Name at least two units of type size in CSS.
Rem, 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?
Div elements 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 does not
How does setting position: relative on an element affect where it appears on the page?
Starts at original position and shifts to top, bottom, left, or right of where it would have been placed.
How does setting position: absolute on an element affect document flow?
Gets removed from document flow
How does setting position: absolute on an element affect where it appears on the page?
Goes to first non static element.
How do you constrain an absolutely positioned element to a containing block?
set the ancestor element that the absolute element should use as its boundary to a non-static position value
What are the four box offset properties?
Top, bottom, left, right.
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?
Styling in you stylesheet that comes later supersedes earlier styling.
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
Children element properties can receive inherited values from their parent elements.
List the three selector types in order of increasing specificity.
Type selector, class selector, ID selector
Why is using !important considered bad practice?
Makes debugging harder by breaking the natural cascading in the stylesheet.
What does the transform property do?
Modifies the coordinate space of the css element.
Give four examples of CSS transform functions.
Rotate, Scale, Skew, Translate
The transition property is shorthand for which four CSS properties?
Transition - property, duration, timing-function and delay
Give two examples of media features that you can query in an @media rule.
min-width, height
Which HTML meta tag is used in mobile-responsive web pages?
viewport.
What is a breakpoint in responsive Web design?
Changes the layout or styling at predefined points.
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?
Percentages are relative to the screen size.
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.