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) Enhancing the Design With CSS Adjusting the Layout with Media Queries

Andrea Monty
Andrea Monty
2,724 Points

Pixels and percentages

How do I know when I need to use pixels and when I need to use percentages? I am confused by when I need to be using what when

1 Answer

Nicholas Vogel
Nicholas Vogel
12,318 Points

It depends on what you need. You use percentages and other ratio based units when you need elements to resize with the viewport (browser window). You use pixels and other absolute units when flexibility isn't important. When those times are is completely up to you.

Andrea Monty
Andrea Monty
2,724 Points

Thank You Nicholas!!! That helps me understand much better!