Sizing Flashcards

1
Q

What is the default width of a block level element?

A

100%

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

Why should we avoid using set pixels units for width?

A

Setting a width with pixels removes the ability for an element to size responsively without additional media queries.

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

When we say a block level element defaults to 100% width, what is that 100% referring to?

A

It refers to the width of the parent element.

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

Should we use the body element to define a max width?

A

Generally no, we should use a different, inner container or wrapper to set the max width.

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

What should we use to set widths of elements in our layouts.

A

We should attempt to use percentage (%) based widths whenever possible.

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

What is one of the disadvantages of using percentage based widths?

A

You can never really know how wide your elements will be, because they are responsive to viewport size.

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

Should we use height values in our CSS layout?

A

Generally no, we should avoid setting a height value on our elements.

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

Why is it best to avoid setting height values on elements in CSS?

A

Height values can disrupt the responsiveness of our website and cause overflow issues.

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

What can we do to create more space around out elements without declaring an element’s height?

A

We can set padding on the child elements within the parent to create space instead of using a declared height.

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

What is 100vh used for?

A

When used with height: it sets the element to be 100% of the viewport height.

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

Is height: 100vh; responsive?

A

Yes, this height will change in relation to the viewport window, so resizing the browser window will resize this element.

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

What is a danger of using height: 100vh;?

A

On smaller screens and mobile, we can have content spill out of the container element using 100vh.

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

How is vmax used in sizing elements in CSS?

A

vmax determines its size based on the longest dimension of the viewport.

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

How is vmin used in sizing elements?

A

vmin determines its size based on the shortest dimension of the viewport

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

Were might we use vw in regards to typography?

A

We might use vw to set the size of title text to make it responsive to viewport width.

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

What might we use to ensure that title text doesn’t responsively grow too large.

A

We might use vmin to set the font-size to prevent overgrowth on wide screens.

17
Q

What might we use to ensure that title text doesn’t responsively grow too large.

A

We might use vmin to set the font-size to prevent overgrowth on wide screens.

18
Q

When would you use width: 100%; and max-width: somepx; in the same style rule?

A

We would use both when we have an element whose width you’d like to limit, but have it remain responsive.

19
Q

How do we use min() to control sizes in CSS?

A

The min() contains one or more comma separated calculations and will choose the smaller of the results.

20
Q

Name three CSS comparison functions.

A
  1. min()
  2. max()
  3. calc()
21
Q

With a container size of 900 pixels what will min() equal?

min(50%, 500px)

A

min will calculate to 50% of 900, or 450 pixels

22
Q

What do we use the min() comparison function for?

A

To set a maximum value of something.

23
Q

What do we use the max() comparison function for?

A

To set a minimum value of something.

24
Q

How do we use the max() comparison function in CSS?

A

The max() contains one or more comma separated calculations and will choose the largest among them.

25
Q

With a container size of 900px what does max compute to?

max(50%, 500px)

A

max calculates to 500px

(b/c 50% of 900 is 450px)

26
Q

How do we use the clamp() function in CSS

A

The clamp function keeps the value between a min and max value. It takes three parameters:

calc(min, preferred, max)

27
Q

What is a default style rule regarding images that we might add to the upper code of our CSS?

A

We might consider adding:

img { width: 100%}

to ensure that our images remain responsive when they are placed within a container that might grow or shrink.

28
Q

What unit of measure is ‘ch’?

A

ch stands for character, and is equivalent to the width of 0 character

29
Q

Where might we use the ‘ch’ unit of measure?

A

When controlling typography we might set out max-width to be #ch.

30
Q

Where are percentages used in CSS?

A

Typically they are used in setting widths relative to their parent element.

31
Q

When we talk about relative units, what and how many types are we generally talking about?

A

We are usually talking about:

  1. Units relative to font size (rem, em)
  2. Units relative to viewport size (vh, vw, vmin, vmax)
32
Q

What is the default width of a block element?

A

100%

33
Q

Should we set both a width and height on an image?

A

Not usually, setting both can distort an image if the ratio does not match the image ration of width and height.

34
Q

How to we ensure that an image or element does not become too large or too small on the page?

A

We can set both max-width and mix-width for items, this is common with images that we do not want to grow too large.

35
Q

Do we use percentages for the max-width of elements in our display?

A

Generally, for images, we can set a max-width in a percentage. On containers or containing elements we would set a pixel value for max-width.