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 trialmary battlebury
527 Pointswas told that it's bad practice to have pixel values and em values together?
hey there , i have also recently started a css fundamentals lesson on the lynda.com site, (currently a student wanting to get a better grasp on web design)
I've been reading that it is not good practice to alternate between pixel and em values on your css sheets. Is this only in relation to type size? as it states that responsive design works better with relative units such as em?
Just posting this now as I just came across these opinions about solely relying on em
thanks : )
1 Answer
Jonathan Grieve
Treehouse Moderator 91,253 PointsHi there Mary
I'm not sure what you mean by Alternate between pixels and ems but you're right that ems are best for responsive design as it's a relative unit not a fixed size like pixels.
Are you aware of how to use CSS media queries yet? You can use these to create a fluid design in different screen sizes but keep a fixed design on desktop screens, :-)
mary battlebury
527 Pointsmary battlebury
527 PointsHi Jonathan thanks a lot for replying! :)
Actually haven't reached media queries yet, have been reading up on css fundamentals and it was briefly emphasised the importance of em as more flexible unit for responsive design,
Sorry by alternate I was just referring to the css in the website course here, as there are pixel values and em values on the same style sheet so was wondering if that is good practice?
Jonathan Grieve
Treehouse Moderator 91,253 PointsJonathan Grieve
Treehouse Moderator 91,253 PointsHi Mary :)
I'm not absolutely sure but I'd be bold enough to suggest it's not and that you should be consistent in your value types as much as possible :)
mary battlebury
527 Pointsmary battlebury
527 PointsHi Jonathan!, No worries, so would you suggest I still finish this project even if em values are being used with pixels? (not yet fully competent on using em values solo yet lol)
Jonathan Grieve
Treehouse Moderator 91,253 PointsJonathan Grieve
Treehouse Moderator 91,253 PointsJust do what makes you comfortable for now :)
Your CSS education has only just begun!
The How to Make a Website course and Guil Hernandez's CSS courses will give you the confidence to use CSS correctly and competently! :)
Good luck!