Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.