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?
starts with . followed by name
In CSS, how do you select elements by their type?
the name of the element
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 move with the width so it scales as it changes creating more visual appeal
In CSS, how do you select an element by its id attribute?
by # followed by name
What CSS properties make up the box model?
border margin, padding, and 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
Which CSS property add space between a box’s content and its border?
padding
Name three different types of values you can use to specify colors in CSS
hsl, rgb, and hex colors
What is a pseudo-class?
keyword added to a selector that specifies a special state of the selected element(s)
What are CSS pseudo-classes useful for?
Event based styling, (such as user interaction) focus, hover, visited,
based on position with sibling elements
Name at least two units of type size in CSS.
px, , rem, (adaptive uses percentages)
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 elements so they take up 100% of the width
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?
does not do anything initially
How does setting position: relative on an element affect where it appears on the page?
it would remain the same
How does setting position: absolute on an element affect document flow?
removes it from document flow
How does setting position: absolute on an element affect where it appears on the page
they position themselves within the firs non-static element.
How do you constrain an absolutely positioned element to a containing block
set an element to position relative
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?
order of which you put the rules. lower rules take effect than previous ones
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, class, and id
Why is using !important considered bad practice?
because it cannot be change, or edited after which may bring
What does the transform property do?
allows adjustment of an element on a page, transforms comes after everything is rendered
Give four examples of CSS transform functions
rotate, translateY, Scale, translateX, skew
The transition property is shorthand for which four CSS properties?
property, duration, timing function, delay
Give two examples of media features that you can query in an @media rule
screen , speech, print
Which HTML meta tag is used in mobile-responsive web pages?
What is a breakpoint in responsive Web design?
A point where the styling may change such as hitting a certain width or such.
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?
it is because of source order where the most recent css takes affect