CSS Flashcards
Name three different types of values you can use to specify colors in CSS
Hex , color name, rgb
Why is using !important considered bad practice?
it makes debugging more difficult
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
What does the term “source order” mean with respect to CSS?
the order that your CSS rules are written in your stylesheet.
Top=weaker
Bottom=Stronger
What are the four components of “the Cascade”.
Inheritance, Specificity, !important, Source Order
What CSS properties make up the box model?
Height Width 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 is the space between the border of a box and any content contained within it.
Name two types of units that can be used to adjust font-size in CSS.
Pixels & Percentages
What CSS property controls the font used for the text inside an element?
The font-family property allows you to specify the typeface that should be used for any text inside the element(s) to which a CSS rule applies.
What is a pseudo-class?
A CSS pseudo-class is a keyword added to a selector that specifies a special state of the selected element(s).
What are CSS pseudo-classes useful for?
All pseudo-classes behave in this same kind of way. They target some bit of your document that is in a certain state, behaving as if you had added a class into your HTML. Take a look at some other examples on MDN:
What is the default value for the position property of HTML elements?
Static Position
How does setting position: relative on an element affect document flow?
normal flow
How does setting position: relative on an element affect where it appears on the page?
Relative positioning moves an element in relation to where it would have been in normal flow.
How does setting position: absolute on an element affect document flow?
When the position property is given a value of absolute,the box is taken out of normal
flow and no longer affects the position of other elements on the page. (They act like it is not there.)
How does setting position: absolute on an element affect where it appears on the page?
The box offset properties (top or bottom and left or right) specify where the element
should appear in relation to its containing element.
How do you constrain an absolutely positioned element to a containing block?
Set element in non static element