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 Pixel Units

Batuhan Bardak
Batuhan Bardak
3,107 Points

Should we avoid from using px ?

pixels are absolute values so I think that it is not good choice for responsive design. Depend on this, my question is should we avoid from using pixels length or in which situation should we use it ?

Thanks !

2 Answers

David Conner
STAFF
David Conner
Treehouse Guest Teacher

Relative units such as percentages or ems, rems, etc. are always better to use as they are not fixed values. Pixels can be used but you will be causing a lot more work. Take this codepen for example. http://codepen.io/davidicus/pen/LEWReB . I am able to scale these icons by changing one font-size because I have used relative units. If I had used pixels I would have to adjust each and every pixel value for each break point.

David those CSS credit cards are amazing!

David Conner
David Conner
Treehouse Guest Teacher

Blake Boykin Thanks, Greatly appreciated! They were fun to make.

pat barosy
pat barosy
6,759 Points

I agree with Blake, your project is amazing. Some of the code I can follow, some not so much. Did you use SASS on this project? How long did it take you to learn how to do something like that.

Caleb Kleveter
MOD
Caleb Kleveter
Treehouse Moderator 37,862 Points

You use percentages instead, it talks about it in the next video.