CSS Flashcards
What are the names of the individual pieces of a CSS rule?
selector
opening curly brace for declaration block
property: value;
ending curly brace of the css rule
In CSS, how do you select elements by their class attribute?
.class-name {
In CSS, how do you select elements by their type?
element name
In CSS, how do you select an element by its id attribute?
id-name {
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
Which CSS property pushes boxes away from each other?
Margin - sits on the outside of the border
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.
What is the box model
Box model uses border margin padding to decide the size of a single box
Size of box is calculated with what (width)
width + padding-left + padding-right + border-left + border-right
Size of box is calculated with what (height)
height + padding-top+ padding- bottom + border-top + border bottom
What is a pseudo-class?
class applied by the browser in certain situations.
Name 3 pseudo-classes
hover, active, focus
What are CSS pseudo-classes useful for?
More interactive webpage
Name at least two units of type size in CSS.
pixels, percentages, ems
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?
It’s just a straight line there is no wrap at all.
Why do two div elements “vertically stack” on one another by default?
because divs 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?
does not affect the position or surrounding element
How does setting position: relative on an element affect where it appears on the page?
Shifts in element in left right top bottom direction and does not affect the position
How does setting position: absolute on an element affect document flow?
The element is taken out of normal flow and doesn’t affect the positioning of surrounding elements.. Element gets ignored
How does setting position: absolute on an element affect where it appears on the page?
Absolutely positioned elements
move as users scroll up and
down the page.
How do you constrain an absolutely positioned element to a containing block?
needs to find a non-static parent, or neighbor if not uses the viewport
What are the four box offset properties?
top, bottom, left, right
What does the transform property do?
it allows you to modify the coordinate x y z space of the css
Give four examples of CSS transform functions?
matrix, translate, scale, rotate, 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.
color, height, min-width
Which HTML meta tag is used in mobile-responsive web pages?
viewport
What is a breakpoint in responsive Web design?
The points at which a media query is introduced are known as breakpoints. So it makes the webpage responsive when the screen-size gets bigger or smaller
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?
flexibility with different viewports
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