Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialToni Caktas
16,957 Pointshow do I do this with rem?
Simple explanation how does the rem unit work...don't quiet get it?
1 Answer
notf0und
11,940 PointsGreat question! 1rem is equal to the font-size specified or defaulted to in the root of the document. For example:
html {
font-size: 20px;
}
h1 {
font-size: 1rem
}
p {
font-size: 0.7rem
}
Now, because 20px is the font-size specified in html
(or root), 1rem will be equal to 20px. In p
, font-size is set to 0.7rem, or 70% of 20px, which will equate to 14px.
For a more detailed look at why and how you'd use rem units, look here: http://css-tricks.com/rems-ems/