CSS Flashcards

1
Q

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

A

selectors
declaration block
property:value (also called declaration)

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

using a “.” in front of the class name

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 tag name?

A

use an element name

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

using # in front of the id name

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

RBG
HEX
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

width
height
padding
border
margin

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 –> youre like gaining weight

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 –> it’s like wearing a big puffy jacket
things inside is the same but outside is getting bigger

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

What is a pseudo-class?

A

it is a class that gives a special effect to the selector whether it’s for the user or where it falls on html document.

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

allows style changes and it allows users to interact with the elements

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

Name two types of units that can be used to adjust font-size in CSS.

A

px
%
em

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-size

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

try to fit in one line but it can wrap as needed

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 div is a block element

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?

A

to make the direction into a row –> left to right

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

What are the three primary components of a page layout? (Which helper classes do you need?)

A

container
row
column

18
Q

What is the minimum number of columns that you should put in a row?

A

1

19
Q

What is the purpose of a container?

A

to confine all the content into one box

20
Q

what is the purpose of the row class

A

to declare that there is a new row formed on the page layout

one vertical chunk and there is a row

21
Q

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

A

static

22
Q

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

A

it allows the element to move relative to where it was supposed to be
if you move it around, the sibling will still think that you are in the same place still even if it’s not

23
Q

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

A

it moves relative to its original position

24
Q

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

A

the element will stay on the page position while the page move up and down

element removed from the page - act as if it’s not there from the document

absolute is useful for layering

25
Q

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

A

the absolute element is encapsulated by the closest ancestor element that’s
position:relative – nearest non-static ancestor or parent element

26
Q

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

A

assign it to the position: fixed or position: relative (more desireable)
as long as they are not static but relative has less consequences

27
Q

What are the four box offset properties?

A

top, right, bottom, and left

28
Q

What are the four components of “the Cascade”.

A

inheritance, specificity, source order, !important

29
Q

What does the term “source order” mean with respect to CSS?

A

whatever is written the most recent is what takes priority
governs the priority in the stylesheet

30
Q

How is it possible for the styles of an element to be applied to its children as well without an additional CSS rule?

A

inheritance

31
Q

List the three selector types in order of increasing specificity.

A

type < class < id

32
Q

Why is using !important considered bad practice?

A

because there’s no turning back once it is used!!!

33
Q

What does the transform property do?

A

Let’s you rote, scale, skew, or translate an element
modifies the coordinate space of the CSS formatting model

34
Q

Give four examples of CSS transform functions.

A

rotate, scale, translate, skew, matrix

35
Q

The transition property is shorthand for which four CSS properties?

A

transition-duration
transition timing function
transition delay
transition preoperty

36
Q

Give two examples of media features that you can query in an @media rule.

A

min-width & max-width

37
Q

Which HTML meta tag is used in mobile-responsive web pages?

A

viewport-meta tag

38
Q

What is the affect of setting an element to display: none?

A

got removed from the document flow

39
Q

What is a breakpoint in responsive Web design?

A

the points at which a media query is introduced
styling changes in the specific moment**

40
Q

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?

A

it’s able to adapt to its new environment when width changes size
when its px, your layout would look weird faster when you change the size
when you use %, you have more wiggle room so you don’t need that many @media query

41
Q

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?

A

due to the source order
the lower styling is stronger than the before