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

Andrew Felix
Andrew Felix
1,517 Points

Is % (percentage unit) responsive?

I gave font-size : 150% to p element. It gave 24px (computed value) font-size initially for p element. When I resize the window to smaller size (small view port), The font-size for p element should get reduced in relation to the view port size right? size of the font for p element seems to be same as original. It is not responsive right?? Please help!

2 Answers

Tray Denney
PLUS
Tray Denney
Courses Plus Student 12,884 Points

Font-size percentages are not responsive in that way. They are responsive to the browser zoom/type settings. If you want to change the size of the text based on the window then you will need to use media queries or you can use viewport values: https://css-tricks.com/viewport-sized-typography/

Andrew Felix
Andrew Felix
1,517 Points

Thanks a lot for your immediate help Denney! The solution you provided and the article you mentioned are really great!

Because they are connected not to browser width and height but to the user agent stylesheet. These values are fixed.