CSS Flashcards

1
Q

Name three different types of values you can use to specify colors in CSS.

A

Color names
Hex codes
RGB values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are the names of the individual pieces of a CSS rule?

A

selector { declaration property name: declaration property value; }

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How are key/value pairs related to CSS?

A

key/value = name/value

In CSS: property name / property value

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are three important considerations for choosing fonts?

A

Readability
Installed fonts
Sticking with theme

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Why must you have backup fonts assigned when selecting custom fonts?

A

Fallback fonts in case the selected font is not installed on user’s computer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Read the code.

background-color : rgb (0, 0, 0)

A

There is a property of background color with the value of rgb css function and three parameters of 0, 0 0

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What CSS properties make up the box model?

A

Margin
Border
Padding
Content

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What CSS property pushes boxes away from each other?

A

Margin property

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What CSS property pushes box content away from its border?

A

Padding property

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What purpose does the CSS Cascade serve?

A

Determines what styling will be applied to an element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What is source order?

A

The order CSS rules are written in a stylesheet

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

In what situations might you need to apply styling to a single element multiple times in one stylesheet?

A

Mobile responsiveness

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is inheritance?

A

For certain properties, when applied to a parent element will also get taken on by any child elements
*usually font or text related

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Why might CSS include inheritance?

A

Save developers time & keep code DRY

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the purpose of !important?

A

Highest level of importance for CSS rule

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

When is !important a good tool to use?

A

Almost never

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

What is specificity?

A

The weight or importance placed on different types of selectors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

How is specificity calculated?

A

Numerical:
0.0.0
(tag selector, class selector, id selector)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

Why might CSS include specificity?

A

Gives a tool to add more specificity if needed

To override specificity of an element

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

What is the order of selector strengths for CSS specificity?

A

Tag selectors
Class selectors
ID selectors

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

What is CSS Cascade?

A

How CSS determines in what order to apply styling to elements, depending on source order and specificity

22
Q

What are CSS pseudo-classes good for?

A

Can apply styles to an element in a changed state (like hover) without affecting the DOM

23
Q

What does the transform property do?

A

Manipulates an element

24
Q

What is the difference between the :first-child pseudo selector and the :last-child pseudo selector?

A

:first-child - applies styling to the first element of the specified element type

:last-child - applies styling to the last element of the specified element type

25
What are 3 examples of what can be done with CSS transitions?
1. Changing button colors fluidly 2. Resizing images to make an emphasis 3. Hiding an element slowly movement, scale, rotate - small movements
26
Why might transitions be a helpful effect for styling?
More visually appealing for the user, more fluid, UI feel more comfortable for users
27
Are all properties able to be transitioned?
No, only ones that are animatable | *usually ones that have px rem em
28
What are the default width and height of a block-level element?
Width - parent container (all available area) Height - content (auto) starts on new line
29
What are the default width and height of an inline element?
Height - auto | Width - auto
30
What is the initial display property of "div"?
Block
31
What is the difference between display: none and visibility: hidden?
display: none - removes element from flow of document visibility: hidden - does not affect the flow of webpage
32
What is the difference between block, inline block, inline?
Block - takes all the space Inline - takes only as much space as needed Inline block - still can adjust size but only takes as much space needed
33
Why are CSS resets helpful for cross browser compatibility?
Helps to create consistency among default styling across browsers and lets you start off with the same blank slate instead of trying to fight the browser styling * Leaving very little up to browser stylesheet
34
Why is it important to be mindful of what you reset with your CSS resets?
Sometimes you could reset something you don't mean to or harm the page
35
What is an argument against using CSS resets?
It slows down the load times of webpage | Might end up resetting that value again anyway
36
What is the default value for the position property of HTML elements?
Position: static;
37
How does setting position relative on an element affect document flow and where the element appears on the page?
Element appears relative to where it was originally | Original space remains there, does not affect document flow
38
How does setting position absolute on an element affect document flow and where the element appears on the page?
Element appears relative to it's parent container/element (whose position isn't static) Taken out of the document flow
39
What are the box offset properties?
``` Top Right Bottom Left * affect the positioning of the element when not static ```
40
What were floats originally designed for?
Originally designed to allow developers to float text around image element like in print
41
What are clears for with floats?
No other element within the same parent container can touch the left or right (or both) sides
42
What is the default flex-direction of a flex container?
flex-direction: row;
43
What is the default flex-wrap of a flex container?
flex-wrap: no-wrap;
44
Why should flexbox not be used for building complete web page layouts?
Mostly good for one dimensional layouts (single row or column) Needs to have set sizing
45
Why is it important to use a grid system for CSS layouts?
To maintain proper sizing & spacing | Working on a team because allows you better understand code
46
What are the three core parts of a grid system?
Container Row Column
47
Why is it a good idea to use percentages for grid column widths?
More flexible/responsive - px would require more work to change Evenly spaced across container
48
What is a modal?
CSS display property value that allows you to overlay an element over a parent element or website ** Pop up window in the viewport that we are in control of
49
What are some use cases for modals?
``` Error alert Warning before proceeding Ad Verification, login When a news site wants you to subscribe before you can read their news article or turn off adblocker ```
50
Why does a modal usually need to occupy the entire height and width of the viewport?
To prevent the user from interacting with the site before you want them to
51
Give two examples of media features that you can query in an @media rule.
Color, width, height
52
Which HTML meta tag is used in mobile-responsive web pages?
< meta name="viewport" content="width=device-width, initial-scale=1" >