CSS Flashcards
What are the names of the individual pieces of a CSS rule?
Selector → the element ex: p {} and a declaration: contain a property and a value ex: font-family:Arial;
In CSS, how do you select elements by their class attribute?
.element
In CSS, how do you select elements by their type?
Just the name if the element retrieved
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.
Hex code, rgb function,name color
What CSS properties make up the box model?
Border, margins, padding
Which CSS property pushes boxes away from each other?
Margin
Which CSS property adds space between a box’s content and its border?
padding property
What is a pseudo-class?
Classes that are applied based on a certain state or anything that is happening, that is put by the browser.
Name at least two units of type size in CSS.
Erm and 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?
Horizontal in a 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?
Block elements
What is the default value for the position property of HTML elements?
Static, no behavior -> normal document flow
How does setting position: relative to an element affect document flow?
Does Not change document flow in any way
How does setting position: relative on an element affect where it appears on the page?
No effect
How does setting position: absolute on an element affect document flow?
Removed from the document flow, done from the document flow , to position elements on top of other elements
How does setting position: absolute on an element affect where it appears on the page?
The absolute element appears on the page within the nearest non-static positioned element.
How do you constrain an absolutely positioned element to a containing block?
Set it to something other than static
What are the four box offset properties?
Top-bottom left right
What are the four components of “the Cascade”.
source order, specificity, inheritance
What does the term “source order” mean with respect to CSS?
Styling that is lower takes precedence of properties that are higher
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, id
Why is using !important considered bad practice?
To make code and rules reusable.
What does the transform property do?
lets you rotate, skew, scale, etc. on the coordinate space of the CSS model
Give four examples of CSS transform functions.
rotate. skew, scale, matrix
Give two examples of media features that you can query in an @media rule.
min-width, max-width
Which HTML meta tag is used in mobile-responsive web pages?
viewport