CSS Flashcards

1
Q

CSS Syntax

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

A

Declaration, selector, properties, values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
CSS Syntax
In CSS, how do you select elements by their class attribute?
A

Period symbol and name of class

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

CSS Syntax

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

A

Name of element

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

CSS Syntax

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

A

The one specified after the pound or hash symbol(#) and name of id

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

CSS Colors

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

A

RGB values, HEX codes, color names

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

CSS Box Model

What CSS properties make up the box model?

A

Width, height, border, margin, padding

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

CSS Box Model

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

CSS Box Model

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

CSS Pseudo Classes

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(s). For example, :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

CSS Pseudo Classes

What are CSS pseudo-classes useful for?

A

It helps users to interact and know if the object responded to users’ request. Change appearance of elements when a user interact with them.

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

CSS Fonts

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

A

Pixels, percentages, ems

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

CSS Fonts

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

CSS Flexbox

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

CSS Flexbox

What is the default flex-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

CSS Layout

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

A

Because div is a block-level element where it starts on a new line and has a full-width

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

CSS Layout

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

A

Row

17
Q

CSS Positioning

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

A

static

18
Q

CSS Positioning

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
Does not affect document flow.

19
Q

CSS Positioning

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

A

Does allow us to move elements on the page
-The offset does not affect the position of any other elements, thus the space given for the element in the page layout is the same as if position were static.

20
Q

CSS Positioning

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

A

When the position property is given a value of absolute 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)

21
Q

CSS Positioning

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

A

An absolutely positioned element no longer exists in the normal document flow. Instead, it sits on its own layer separate from everything else.

22
Q

CSS Positioning

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

A

Set it to non static position property

23
Q

CSS Positioning

What are the four box offset properties?

A

-top, bottom, left, right

24
Q

CSS-Cascade

What are the four components of “the Cascade”.

A

Source order, inheritance, specificity, !important

25
Q

CSS-Cascade

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

A

Source order is, simply put, the order that your CSS rules are written in your stylesheet. The styling provided for an element last in your stylesheet is the styling that will ultimately take effect

26
Q

CSS-Cascade

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 is the process by which 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

CSS-Cascade

List the three selector types in order of increasing specificity.

A
Type selector e.g (h1) and psuedo-elements (e.g ::before).
Class selectors (e.g. .example), attribute selectors (e.g. [type=”radio”] and pseudo-classes(e.g. :hover).
ID selectors (e.g. #example).
28
Q

CSS-Cascade

Why is using !important considered bad practice?

A

It makes debugging more difficult by breaking the natural cascading in your stylesheets. The only way to override !important is to use other !important or use JavaScript to remove it.

29
Q

CSS-Transforms

What does the transform property do?

A

The transform CSS property lets you rotate, scale, skew, or translate an element. It modifies the coordinate space of the CSS visual formatting model.
Manipulate the way it looks

30
Q

CSS-Transforms

A

Give four examples of CSS transform functions.

translateY(), translateX(), skew(), roate(), scale()

31
Q

CSS-Transitions

The transition property is shorthand for which four CSS properties?

A

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

32
Q

CSS-Media-Queries

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

A

Min-width, max-width

33
Q

CSS-Media-Queries

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

A

Viewport meta tag

34
Q

CSS-Responsive-layout

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.

  • breakpoint is used when a certain style needs to be applied to a media query.
  • Point where media query activates or is introduced
35
Q
CSS-Responsive-layout
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

We don’t know how big user’s screen will be so the percentage can define a size as relative to an element’s parent object. Percentage of that content would fill the viewport.

36
Q

CSS-Responsive-layout
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

CSS cascade that the bottom CSS applied first.