Sizing Flashcards
(35 cards)
What is the default width of a block level element?
100%
Why should we avoid using set pixels units for width?
Setting a width with pixels removes the ability for an element to size responsively without additional media queries.
When we say a block level element defaults to 100% width, what is that 100% referring to?
It refers to the width of the parent element.
Should we use the body element to define a max width?
Generally no, we should use a different, inner container or wrapper to set the max width.
What should we use to set widths of elements in our layouts.
We should attempt to use percentage (%) based widths whenever possible.
What is one of the disadvantages of using percentage based widths?
You can never really know how wide your elements will be, because they are responsive to viewport size.
Should we use height values in our CSS layout?
Generally no, we should avoid setting a height value on our elements.
Why is it best to avoid setting height values on elements in CSS?
Height values can disrupt the responsiveness of our website and cause overflow issues.
What can we do to create more space around out elements without declaring an element’s height?
We can set padding on the child elements within the parent to create space instead of using a declared height.
What is 100vh used for?
When used with height: it sets the element to be 100% of the viewport height.
Is height: 100vh; responsive?
Yes, this height will change in relation to the viewport window, so resizing the browser window will resize this element.
What is a danger of using height: 100vh;?
On smaller screens and mobile, we can have content spill out of the container element using 100vh.
How is vmax used in sizing elements in CSS?
vmax determines its size based on the longest dimension of the viewport.
How is vmin used in sizing elements?
vmin determines its size based on the shortest dimension of the viewport
Were might we use vw in regards to typography?
We might use vw to set the size of title text to make it responsive to viewport width.
What might we use to ensure that title text doesn’t responsively grow too large.
We might use vmin to set the font-size to prevent overgrowth on wide screens.
What might we use to ensure that title text doesn’t responsively grow too large.
We might use vmin to set the font-size to prevent overgrowth on wide screens.
When would you use width: 100%; and max-width: somepx; in the same style rule?
We would use both when we have an element whose width you’d like to limit, but have it remain responsive.
How do we use min() to control sizes in CSS?
The min() contains one or more comma separated calculations and will choose the smaller of the results.
Name three CSS comparison functions.
- min()
- max()
- calc()
With a container size of 900 pixels what will min() equal?
min(50%, 500px)
min will calculate to 50% of 900, or 450 pixels
What do we use the min() comparison function for?
To set a maximum value of something.
What do we use the max() comparison function for?
To set a minimum value of something.
How do we use the max() comparison function in CSS?
The max() contains one or more comma separated calculations and will choose the largest among them.