CSS Flashcards

1
Q

CSS-syntax

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

A

= selector and a declaration( which has property and a value)

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

= . classname

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

= by putting element name

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

= #idname

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

= hex code (#FFD700)
= color name (147 names supported by browsers)
= RGB values (rgb 102,205,180)

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

= border, margin, padding, width, and height

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 class
What is a pseudo-class?
A
= a class you can change the appearance of elements when a user is interacting with them. (ex. :hover)
= to add styles to selectors, but only when those selectors meet certain conditions
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
CSS-pseudo class
What are CSS pseudo-classes useful for?
A

= for defining a special state of an element.
= (applying styling element when mouse hover over it.)
= styling selectors

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, em, rem

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 elements are block level elements.

block-level elements start on a new line

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

what are the four components of “the Cascade”?

A
  • source order
  • inheritance
  • specificity
  • !important
18
Q

CSS-cascade

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

A

= the order that your CSS rules are written in your stylesheet.
= styling provided for an element “last” in your stylesheet is the styling that will ultimately take effect.

19
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. (useful for text)

20
Q

CSS-cascade

List three selector types in order of increasing specificity

A

element type -> class -> id (heaviest specificity)

21
Q

CSS-cascade

why is using !important considered bad practice?

A

= it makes debugging more difficult, by breaking the natural cascading in stylesheets.
= !important supersedes everything.

22
Q

CSS-transforms

What does the transform property do?

A

= Transform property lets you rotate, scale, skew, or translate an element,

23
Q

CSS-transforms

Give four examples of CSS transform functions.

A

= transform: rotate (rotates clockwise(+deg) or counter-clockwise(+deg))
= transform: skew (distorts each point within an element by a certain angle in the horizontal and vertical directions)
= transform: matrix (defines a homogeneous 2D transformation matrix.)
= transform: translate (moves element up(-value) or down(+value)

24
Q

CSS-responsive-layout

What is a breakpoint in responsive Web design?

A

= 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

25
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
=  Gives ability to have variance. Leg of room.  => for elements inside container
= Hard px value for class container.
26
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

= Source order.

= Media query is depend on the source order of CSS ruleset.

27
Q

CSS-media queries

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

A

= Width, color (min-width, and max-width) is mostly used.

= Min-width is used widely for phone

28
Q

CSS-media queries

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

A

= HTML viewport meta tag
= < meta name=”viewport” content=”width=device-width, initial-scale=1.0” >
= Value of viewport

29
Q

CSS-media queries

***Put the media query at the end. (source order) ⇒ always at the end of CSS rules.
- Viewport meta tag:
=> In order to use this tag, check for the version of the HTML file that is up to the latest version. Older versions may not work.

A
  • only screen = make sure to declare the type of screen you want to declare (ex. print, for print-friendly version), or screen for screens.