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

Should I use a px or a % value for a grid-template row/col?

.

1 Answer

The short answer would be both are correct. This would depend on design. Provided the pixel based columns are reconfigured by breakpoints so that the total width always fits the window/device in a planned and intentional way..

Sometimes it is easier to use pixels for desktop, when the columns are at maximum size, and percentages seem as you drop below that max width.

I personally prefer the more flexible percentage based columns, and would usually design a website to use them. If you are working with a designer this is the type of conversation you should have upfront. Make sure there’s no misunderstanding on how the final product will behave.