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 trialNiomi Consten
1,587 PointsWhy does he keeps switching from percent to px to em? Every line is something different. How do I know which one to use?
I just started learning html and css, and was wondering why the teacher keeps switching for percentage to pixel to em. I thought he said pixel wasnt as good but he keeps using it.
Example:
h1 { font-family: 'Changa One', sans-serif; margin: 15px 0; font-size: 1.75em; font-weight: normal; line-height: 0.8em; }
3 different sizing styles? Why use pixels at all if we want to make it responsive? Can you use all of them at once? Please someone explain these rules to me.
Thanks a lot!
Greetings from a css noob :)
1 Answer
Jake Nisenboim
3,374 PointsEm is essentially a multiplier. It is relative to the default font size (which is usually 16px).
Px allows you to be more specific, while using em can save time.
I don't recall using percent in font-size though.
Please let me know if that helps !
Good luck !