CSS Flashcards
What are the names of the individual pieces of a CSS rule?
Selectors - indicate which element the rule applies to.
The same rule can apply to more than one element if you separate the element names with commas.
Declarations
Indicate how the elements referred to in the selector should be styles.
Declarations are split into two parts (a property and a value), and are separated by a colon
Property and value
In CSS, how do you select elements by their class attribute?
Use a dot .class Use class for CSS
In CSS, how do you select elements by their type?
Using a css selector
Matches elements name / write name of element
In CSS, how do you select an element by its id attribute?
#id Hashtag and name of ID
Name three different types of values you can use to specify colors in CSS.
These express color in terms of how much red, green, and blue are used to make it up.
rgb(100,100,0)
Hex Codes
These are six digit codes that represent the amount of red, green, and blue in a color preceded by a pound or hash # sign.
#ee3e80
Color name
There are 147 predefined color names that are recognized by browsers.
DarkCyan
What CSS properties make up the box model?
Border - Every box has a border. The border separates the edge if one box from another
Margin - Margins sit outside the edge of the border. You can set the width of a margin to create a gap between the borders of two adjacent boxes.
Padding - is the space between the border of a box and any content contained within it. Adding padding can increase the readability of its content
Content: The area where your content is displayed, which can be sized using properties like width and 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?
A class applied by the browser when the element is in a selected states
What are CSS pseudo-classes useful for?
It is useful for changing appearances of elements based on interaction
Name two types of units that can be used to adjust font-size in CSS.
Pixels - pixels are commonly used because they allow web designers very precise control over how much space their text takes up.
The number of pixels is followed by the letters px.
Percentages - takes percentage of the default size of text or percentage or parent size of text
Ems - equivalent to the width of the letter m
Most common are pixel, em and rem
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?
the default flex-direction of a flex container is row (left to right)
What is the default flex-wrap of a flex container?
No wrap - try to fit in one row
Why do two div elements “vertically stack” on one another by default?
Div elements are block and create a new line