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 trial

CSS CSS Basics (2014) Understanding Values and Units Percentages

Beth Farrelly
Beth Farrelly
2,157 Points

Why is the paragraph text being set to 150% equivalent to 24px?

I was just wondering why the paragraph text is relative to the body text and is the default body text size ALWAYS 16px? Thanks in advance!

Hey, He wants to say % instead of pixel. Here's the link where Guil says it "https://teamtreehouse.com/community/at-326-you-say-150px-but-write-150-i-think-you-mean"

5 Answers

ALBERT QERIMI
ALBERT QERIMI
49,872 Points

100% = 16px 150 % = 24 px

The paragraph element is a child of the body element (the parent). I always get told that I look just like my dad, but my mom says I look more like his dad. We both are really good at observing others. I've always been very imaginative & detail-oriented, just like my mom. I am a percentage of my dad & my mom. The same thing is happening here.

I think the default is always 16px. If 100% is the same as 16px, than half of that (50%) would be the same as 8px. 16px + 8px = 24px.

I haven't tried it yet, but it might be possible to change the default font-size from 16px. First, link a normalize.css file to your webpage. Then, edit the normalize.css file to set the font-size to 20px (or whatever you want it to be). In the .html file, link a second .css file that would be used to for styling the webpage. The edited normalize.css file should override the default browser styling, allowing the second .css file to relate to it, rather than the browser styling. Maybe someone more experienced could confirm this.

Mohammed Safiulla D
Mohammed Safiulla D
17,044 Points

Default size is always 16px ( which you can change this with normalize.css - where you can specify your own default size). Also, paragraph is relative to body as it is inside body tag, to further clarify, take the class primary-content and in css set its font-size to 30px, now if you have font-size of p as 150%, then the text in paragraphs inside the class "primary-content" will have size 45px will the font-size of rest of the paragraphs (which are not part of "primary-content") will have their font-sizes set to 24px. Hope that helps :)

Beth Farrelly
Beth Farrelly
2,157 Points

Neither of these responses answered my question, unfortunately :(

I was just scrolling and couldnt help but realize how pretty you are