CSS Flashcards

1
Q

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

A

Selector, then curly braces which contain declaration (property and value)

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

In CSS, how do you select elements by their class attribute?

A

dot followed by the class name, then curly braces for ruleset block

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

In CSS, how do you select elements by their type?

A
  • just the name of the element itself

- e.g. body, h1, p, etc. followed by curly braces for ruleset block

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

In CSS, how do you select an element by its id attribute?

A

symbol and then name of id, then curly braces for ruleset block

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

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

A

rgb, hex code, color name

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

What CSS properties make up the box model?

A

border, margin, padding

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

Which CSS property pushes boxes away from each other?

A

margin

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

Which CSS property add space between a box’s content and its border?

A

padding

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

What is a pseudo-class?

A

keyword added to selector that specifies a special state of the selected element
( e.g. :hover )
Class being applied to an element by the browser for a specific interaction

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

What are CSS pseudo-classes useful for?

A
  • useful for hovering over buttons, focusing on an element
  • applying styling based on user actions or reducing number of classes applied to elements by using pseudo-classes for the html structure
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Name at least two units of type size in CSS

A
  • Pixels, percentages, etc.

- example: px, %, rem

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

What CSS property controls the font used for the text inside an element?

A

Font-family

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

What is the default flex-direction of a flex container?

A

row

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

What is the default flex-wrap of a flex container?

A

nowrap;

all items will be on one line

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

Why do two div elements “vertically stack” on one another by default?

A

because a div element is a block

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

What is the default flex-direction of an element with display: flex?

17
Q

What is the default value for the position property of HTML elements?

A

position: static;

18
Q

How does setting position: relative on an element affect document flow?

A

no effect whatsoever/does not affect document flow at all. Surrounding elements sees it positioned normally

19
Q

How does setting position: relative on an element affect where it appears on the page?

A

Moves it in relation to where it would originally be positioned at default

20
Q

How does setting position: absolute on an element affect document flow?

A

It is removed from the HTML document flow entirely

21
Q

How does setting position: absolute on an element affect where it appears on the page?

A

Take it out of document flow, doesn’t exist anymore

22
Q

How do you constrain an absolutely positioned element to a containing block?

A

Using ‘position: relative’ on the containing block element

23
Q

What are the four box offset properties?

A

Top, right, bottom, left

24
Q

What are the four components of “the Cascade”?

A

Source order, inheritance, specificity, !important

25
What does the term “source order” mean with respect to CSS?
The order that your CSS rules are written in your stylesheet | *the last ruleset you applied will take into effect
26
How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?
It’s possible with inheritance CSS properties on a child HTML element can receive the value from a parent element, if no CSS for that property is directly declared on the child element Inheritable properties. Not all properties are inheritable. Default ones are like text properties
27
List the three selector types in order of increasing specificity.
Type, class, and ID selectors.
28
Why is using !important considered bad practice?
Makes debugging more difficult by breaking the natural cascading in your stylesheets When two conflicting declarations with the !important rule are applied to the same element, the declaration with a greater specificity will be applied. *too strong,
29
What does the transform property do?
adjusting how the element appears on the coordinate plane
30
Give 4 examples of CSS transform functions.
Matrix, translate, scale, rotate, skew, scale translate | * translate, scale, rotate - most commonly used
31
The transition property is shorthand for which four CSS properties?
Transition-property, transition-duration, transition-timing-function, transition-delay
32
What is a breakpoint in responsive Web design?
- point where your styling/content would shift/break | - breakpoints are based on the width of the viewport
33
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?
- It wouldn’t be directly proportional to the physical size of the device’s screen - percentage will change based on how wide the screen is
34
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?
because of the source order
35
Give two examples of media features that you can query in an @media rule
- width, height - min-width, max-width - for mobile, probably gonna use max-width a lot
36
Which HTML meta tag is used in mobile-responsive web pages
- the viewport meta tag | - meta name="viewport" content="width=device-width, initial-scale=1"