CSS Flashcards

1
Q

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

A

Inside a CSS ruleset:

Selector + Declaration Block

Inside the Declaration Block:

Opening.Curly Braces ( { ) + Property + Value + Closing Curly Braces ( } )Inside a CSS ruleset:

Selector + Declaration Block

Inside the Declaration Block:

Opening.Curly Braces ( { ) + Property + Value + Closing Curly Braces ( } )

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

period (dot) before class title

e.g. .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 type?

A

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

Hash-tag before the id title

e.g. #id_title { };

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

Hex

RGBa

RGB

HSL (Hue Saturation Lighting)

HSLa

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

Margin
Border
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

A pseudo-class is added to a selector to specify a certain interaction that occurs when the user interacts with the selected element/id/class specified.

:hover
:focus
:active

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

CSS pseudo-class is useful for changing the appearance of elements when a user is interacting with them.

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 - pixels
rem - root em (approx. 16px)
% - percentage

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 property

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

flex-direction: row (default)

Default direction is left to right which is in 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

flex-wrap: no-wrap (default)

default flex-wrap for a container is no-wrap which means all 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

div elements are block-type elements and so will start a new line when “stacked” on one another

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-direction: row (default)

Left to Right

17
Q

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

A

position: static (default)

18
Q

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

A

Relative position does not affect document flow and only affects the elements own positioning based on its original/relative spot.

19
Q

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

A

position: relative shifts the element relative to its original location

20
Q

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

A

Absolute positioning removes the element from the flow of the document

21
Q

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

A

Positions the element according to either an ancestor element with position:relative or to the entire page

22
Q

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

A

Applying position: relative to its containing block

23
Q

What are the four box offset properties?

A

position: static;
position: relative;
position: absolute;
position: fixed;

24
Q

What are the four components of “the Cascade”.

A

Source Order
Inheritance
Specificity
!important

25
Q

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

A

The order that your CSS rules are written in your stylesheet

Lower the ruleset, the more priority it has

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 means that certain CSS properties on a child HTML element can receive value from a parent element if no CSS for that property is directly declared on the child element

27
Q

List the three selector types in order of increasing specificity.

A

1) ID Selector
2) Class Selector
3) Element Selector

28
Q

Why is using !important considered bad practice?

A

Putting !important on a CSS ruleset may throw away all cascade components of the stylesheet and may ruin the organization of a CSS stylesheet

29
Q

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

A

min-width

max-width

30
Q

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

A

< meta = “viewport” >

Viewport meta tag

31
Q

What is a breakpoint in responsive Web design?

A

Breakpoint is a point in the viewport size where the layout would change

32
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

% width adapts to the viewport sizing

33
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