CSS Flashcards
What are the names of the individual pieces of a CSS rule?
declaration block, selector, properties, values
In CSS, how do you select elements by their class attribute?
.attribute { (putting a period before the name of the class)
In CSS, how do you select elements by their tag name?
type { (type element name)
In CSS, how do you select an element by its id attribute?
id { (type # with id)
Name three different types of values you can use to specify colors in CSS.
RGB Values
Hex Codes
Color Names
What CSS properties make up the box model?
Border, Margin, Padding, Width, Height
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?
class added to a selector that specifies a special state (ex: hover)
What are CSS pseudo-classes useful for?
Let you apply a style to an element for events of users interacting with elements
Name two types of units that can be used to adjust font-size in CSS.
px, rem, em
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 :left to right
What is the default flex-wrap of a flex container?
no wrap
What is align items in flexbox
top to bottom alignment
Why do two div elements “vertically stack” on one another by default?
divs are block elements
What is the default flex-direction of an element with display: flex?
Row: left to right
What are the three primary components of a page layout? (Which helper classes do you need?)
Container, Row, Column
What is the minimum number of columns that you should put in a row?
1 column
What is the purpose of a container?
the purpose of the container is to be able organize the rows and container in a readable manner.
What is the purpose of a row?
Row is used to show content of a vertical chunk within a container.
What is the purpose of a column?
Represents the chunk of a page section in a horizontal view.
What is the default value for the position property of HTML elements?
position:static
How does setting position: relative on an element affect document flow?
Doesn’t affect document flow.
How does setting position: relative on an element affect where it appears on the page?
can move top, bottom, left, right and it will appear on the page depending on where you set it. (Where it was statically)
How does setting position: absolute on an element affect document flow?
the box or element is taken out of normal flow. Sibling elements ignore it.
How does setting position: absolute on an element affect where it appears on the page?
Positioned against the nearest non static ancestor.
How do you constrain an absolutely positioned element to a containing block?
Set position relative to the ancestor.
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 importance
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
the inheritance behavior
List the three selector types in order of increasing specificity.
*global, .class, #id
Why is using !important considered bad practice?
Extremely high specificity, so its very hard to override. Hard to design.
What does the transform property do?
lets you rotate, scale, skew or translate an element.
Give four examples of CSS transform functions.
matrix translate rotate and scale skew
The transition property is shorthand for which four CSS properties?
transition-delay, transition-duration, transition-property, transition-timing-function
Give two examples of media features that you can query in an @media rule.
min-width, min-height, max-width
Which HTML meta tag is used in mobile-responsive web pages?
viewport meta tag