CSS Flashcards

1
Q

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

A

Each new rule is called a rule set. A rule set consist of a selector, followed by a declaration. Inside a declaration, we have a property followed
by a 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

Class attributes are selected by starting with a . followed by a value. ie, .note selects all elements with class attribute that has a value of note

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

We would type the element name as the selector

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

ID attributes are selected by # followed by
their value. ie, #introduction targets elements whose id attributes has a value of introduction

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 codes, and color names

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, padding, border, and margin makes up the
box model

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

The margin pushes boxes away from each
other

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 adds space between a box’s content and its border

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

What is a pseudo-class?

A

They are classes that allow changes in appearance for an element when a user
is interacting with them. They are :hover, :active, and :focus

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

They are useful for responding to user inputs and adding
effects due to user interaction

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

Pixels, percentages (default web
browser is 16 px. This gives us a percentage of the default), em (this is allowing us to change the text
size based off of being relative to the parent class), 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 controls the font
used for the text inside an element

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

The default flex-direction of a flex container is
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 is default. This will insure 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

this is because they are display block elements and takes up the whole space on a row

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

Flex row is the default direction

17
Q

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

A

The default value is static

18
Q

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

A

This will not affect document
flow. However, This moves the an element from the position where it would normally be to any
direction without affecting the surrounding elements. It is like, taking up the same space it would
normally does, but visually it will be displaced

19
Q

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

A

It will be shifted
vertically/horizontally from it’s normal position

20
Q

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

A

The element with absolute
positioning is taken out of the normal flow. It will have no affect on the other elements in the flow

21
Q

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

A

The absolute
element will position to be the closest non-static ancesto

22
Q

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

A

We can use the containing element by giving it a position of non-static. This will give a boundary to their decedents. They
are used to be a container for their children

23
Q

What are the four box offset properties?

A

The four box offset properties are: top, bottom, left, and
right

24
Q

What are the four components of ”the Cascade”.

A

Source order, inheritance, specificity, and important

25
Q

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

A

he order in which the css appears in
the code

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

They inherit the format

27
Q

List the three selector types in order of increasing specificity.

A

ID, Class, then Type

28
Q

Why is using !important considered bad practice?

A

This command will override all other declarations
associated. So, it may ruin the style elsewhere in a page

29
Q

What does the transform property do?

A

They allow us to modify something on a webpage

30
Q

Give four examples of CSS transform functions.

A

matrix, translate, scale, rotate, skew, and scale-
translate

31
Q

The transition property is shorthand for which four CSS properties?

A

It is a short hand for transition-property, transition-duration, transition-timing-function, and transition-delay.

32
Q

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

A

media height and width

33
Q

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

A

The viewport meta tag

34
Q

What is a breakpoint in responsive Web design?

A

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

35
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

Using percentages will allows us to be able to always adapt
properly to the device the page is being viewed on

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 that?

A

This is because the order in
which the rules are executed matter. Since the lower rule is being looked at later, that rule is the most
current one. This is called the source order of the cascade