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


Why create a separate 'Flexbox.css'? is it a bad practice to keep Flex rules in same main.css and why?

creating a separate flex box.css might add to duplication of rules and other errors... i might be wrong but would like to know... what is the best practice and why... Thanks and Cheers!

1 Answer

Kevin Korte
Kevin Korte
28,148 Points

It depends on the project, but its common to see separation of concerns with CSS files, meaning that often parts of the application are broken out into multiple files, so it's easier to find something. I personally try to keep CSS files to only a few hundred lines of code, which often means I could have a dozen or more CSS files in any one project.

It's all about what makes sense to you. In this case, I think what they're trying to show is how you can break out rules into parts that make sense to you, on a smaller project.