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 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.