CSS Flashcards
What are the names of the individual pieces of a CSS rule?
rule set, selector, property, value
In CSS, how do you select elements by their class attribute?
.
In CSS, how do you select elements by their type?
write the name of the element
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.
the name RGB and hexcodes.
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 pseudo class is expressed by adding a colon (:) after a selector in CSS, followed by a pseudo-class such as “hover”, “focus”, or “active
What are CSS pseudo-classes useful for?
CSS pseudo-classes are used to add styles to selectors, but only when those selectors meet certain conditions
what is :nth-child()
The :nth-child() CSS pseudo-class matches elements based on their position in a group of siblings.
Name at least two units of type size in CSS.
percentage, 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?
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
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. relative positioning doesn’t affect the layout, the positioned element is still in its initial place
How does setting position: relative on an element affect where it appears on the page?
it appears relative to where it used to be
How does setting position: absolute on an element affect document flow?
An absolutely positioned element no longer exists in the normal document flow. Instead, it sits on its own layer separate from everything else.
How does setting position: absolute on an element affect where it appears on the page?
An element with position: absolute; is positioned relative to the nearest positioned ancestor
What are the four box offset properties?
top, bottom, left, right
What are the four components of “the Cascade”.
specificity, order important, source order, inheritance
What does the term “source order” mean with respect to CSS?
top to bottom code in css
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
same class name or comma, inheritance
List the three selector types in order of increasing specificity.
,element .class, id
Why is using !important considered bad practice?
its too strong, and cant be overwritten
What does the transform property do?
translate rotate etc etc
Give four examples of CSS transform function
rotate, translate, skew, scale
Give two examples of media features that you can query in an @media rule.
min width, color(basically creating a conditional statement)
Which HTML meta tag is used in mobile-responsive web pages?
viewport metatag
What is a breakpoint in responsive Web design?
the places in which the media queries are 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?
they are responsive
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