CSS Flashcards
What are the names of the individual pieces of a CSS rule?
Selector, declaration block, properties with values
In CSS, how do you select elements by their class attribute?
.name{}
In CSS, how do you select elements by their type?
Just-the-name{}
In CSS, how do you select an element by its id attribute?
name{}
Name three different types of values you can use to specify colors in CSS.
Rgb, hex, color names, hsl
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 adds space between a box’s content and its border?
Padding
What is a pseudo-class?
A pseudo-class is used to define a special state of an element.
For example, it can be used to:
- Style an element when a user mouses over it
- Style visited and unvisited links differently
- Style an element when it gets focus
What are CSS pseudo-classes useful for?
Allow us to add more functionality on a webpage without using javascript.
For example, it can be used to:
- Style an element when a user mouses over it
- Style visited and unvisited links differently
- Style an element when it gets focus
Name at least two units of type size in CSS.
Pixel, rem, em, ch
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 (horizontal direction)
What is the default flex-wrap of a flex container?
No wrap
Why do two div elements “vertically stack” on one another by default?
Because they are block level
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?
Does not affect the document
How does setting position: relative on an element affect where it appears on the page?
It does not affect where it appears on the page UNLESS you move it
How does setting position: absolute on an element affect document flow?
Takes an element out of the normal document flow
How does setting position: absolute on an element affect where it appears on the page?
The location is based on the element’s closest non-statically positioned ancestor.
How do you constrain an absolutely positioned element to a containing block?
You set a position other than static
What are the four box offset properties?
Top, bottom, right, left
What are the four components of “the Cascade”.
Transition, !important, animation, and normal
What does the term “source order” mean with respect to CSS?
The order that the rules appear on the CSS page affect which ones get applied. Items lower on the CSS page have precedence.
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
CSS inheritance
List the three selector types in order of increasing specificity.
Tag, class, id
Why is using !important considered bad practice?
Makes it hard for others to review your code
Why do we log things to the console?
To debug
What is a “model”?
A representation or blueprint
Which “document” is being referred to in the phrase Document Object Model?
The whole html document
What is the word “object” referring to in the phrase Document Object Model?
The objects in the html doc (including the html document itself)
What is a DOM Tree?
Represenation of the html doc and shows all of the relationships between the elements
Give two examples of document methods that retrieve a single element from the DOM.
What does the transform property do?
Modify the physical properties of html elements
Give four examples of CSS transform functions.
Transform x, transform y, rotate, scale, skew, matrix
The transition property is shorthand for which four CSS properties?
Transition-property, transition-duration, transition-timing-function, transition-delay