Sizing Flashcards
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.