CSS Flashcards

1
Q

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

A

selector, declaration block, property, value

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

how do you select elements by their class attribute?

A

.class element

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

how do you select elements by their type?

A

element name {}

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

how do you select an element by its id attribute?

A

id element

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 values, hex code, color name

rgb a , hsl , hsl a

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

content(height, width), 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

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

A css pseudo class is a keyword added to a selector that specifies a special state of the selected element. ex) :hover can be used to change a button’s color when the user’s pointer hovers over it.

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

Pseudo classes let you apply a style to an element not only in relation to the content of the document tree, but also in relation to “external factors” like the history of the navigator(:visited), the status of its content(:checked), or position of the mouse (:hover)

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

rem, 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-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: left to right in ltr; right to left in rtl

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

what is the default ‘felx-wrap’ of a flex container?

A

nowrap : all flex 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

images default is set to full width .

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

left to right (row)

17
Q

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

A

static

18
Q

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

A

relative positioning moves an element in relation to where it would have been in normal flow.

19
Q

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

A

After indicating that an element should be relatively positioned using the position property with a value of relative, you can use the offset properties to indicate how far to move the element from where it would have been in the normal flow (top right bottom left)

  • exactly the same. now it’s just positioned.
20
Q

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

A

The box is taken out of normal flow and no longer affects the position of other elements on the page. ( they act like it is not there )

  • act like elements not exist. big sweeping change.
21
Q

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

A

moves the element to the element that is not static?

22
Q

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

A

by using the value not static.

23
Q

what are the four box offset properties?

A

top right bottom and left

24
Q

what are the four components of “the Cascade”?

A

source order, specificity, inheritance, important rule

25
Q

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

A

If you have more than one rule, which has exactly the same weight, then the one that comes last in the CSS will win. You can think of this as rules which are nearer the element itself overwriting early ones until the last one wins and gets to style the element.

26
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. certain style to the parent and it will be applied to the children unless they have more specific styling

27
Q

list the three selector types in order of increasing specificity.

A

type selectors, class selectors, id selectors.

28
Q

why is using !important considered bad practice?

A

it’s hard to debug and improve the original style.

the only way to override it is to add another important rule or use javascript… which is bad.

29
Q

what does the transform property do?

A

it lets you rotate, scale, skew or translate an element. it modifies the coordinate space of the CSS visual formatting model.

30
Q

give four examples of css transform functions

A

translateX,Y,Z perspective

31
Q

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

A

width height,, things that look like a property but its not a real property

32
Q

which html meta tag is used in mobile-responsive web pages?

A

viewport

33
Q

the transition property is shorthand for which four css properties?

A

transition-property, transition-duration, transition-timing-function, transition-delay

34
Q

what is a ‘breakpoint’ in responsive web design?

A

In responsive design, a breakpoint is the “point” at which a website’s content and design will adapt in a certain way in order to provide the best possible user experience

ex) width

35
Q

what is the advantage of using a percentage width instead of a fixed width for a “column” class in a responsive layout?

A

It is often used to define a size as relative to an element’s parent object.

we don’t know how the user’s screen is gonna be,

36
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 it?

A

cascade. source order applies even when using media queries. pay attention on where your media queries are applied.