Responsive Design Flashcards
Responsive design refers to the ability of a website to resize and reorganize its content based on:
The size of other content on the website.
The size of the screen the website is being viewed on.
What kind of values are pixels?
fixed, hard coded values.
When a screen size changes (like switching from landscape to portrait view on a phone), elements sized with pixels can appear too small, overflow the screen, or become completely illegible.
What kid of measurements can you use in CSS?
Hard coded measurements andrelative measurements
Why do relative measurements offer an advantage over hard coded measurements?
They allow for the proportions of a website to remain intact regardless of screen size or layout.
What is em?
represents the font-size of the current element or the default base font-size set by the browser if none is given
1 em = ____
16 pixels
What is rem?
Rem stands for root em
What is the difference between em and rem?
Instead of checking parent elements to size font, it checks the root element. The root element is the <html> tag.
Most browsers set the font size of<html>to ______, so by default rem measurements will be compared to that value.
16 pixels
How do you set a different font size for the root element?
You can add a CSS rule.
When would it be best to use em?
If you’re interested in sizing elements in comparison to other elements nearby, then the em unit would be better suited for the job.
When would it be best to use rem?
One advantage of using rems is that all elements are compared to the same font size value, making it easy to predict how large or small font will appear. If you are interested in sizing elements consistently across an entire website, the rem measurement is the best unit for the job.
What should you use if you want to size non-text HTML elements relative to their parent elements on the page?
Percentages
Within CSS percentages are often used for what?
Often used to size box-model values, like width and height, padding, border, and margins. They can also be used to set positioning properties (top, bottom, left, right).
Why do you have to be careful using percentages?
When percentages are used, elements are sized relative to the dimensions of their parent element (also known as a container). Be careful, a child element’s dimensions may be set erroneously if the dimensions of its parent element aren’t set first.