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 Bootstrap 4 Basics (Retired) Responsive Layouts with the Bootstrap Grid Styling Content

872 Points

Maintaining all those classes

I understand how you can easily add classes and get a functioning site up and running in no time.

One thing that worries me, is maintaining it. As the code grows and there are going to be more and more pages, will you keep track of all the classes.

For example if you want to adjust margin and padding later, I imagine it can be a lot of work searching for the right classes and adjusting them.

Does Sass help in any way with this? Or are there other tools or best practices to keep in mind?

1 Answer

Annet de Boer
Annet de Boer
900 Points

It's true what you say, in a big website it can be quite challenging to keep things tidy (not only for yourself but also for colleagues working on the same site). One best practice is to keep things categorised, like Sass also asks you to do.

But: "it can be a lot of work searching for the right classes and adjusting them." this is actually not so hard. Open your page in the browser and make use of Developers tools (Chrome) or Firebug (Firefox extension) and point to an element using the identifier tool. You can easily see which classes apply to that element and where (which css file) you can find them. You can even adjust them on the fly to see how the changes would look like and what would be the consequences for other elements. Once you know the name of the class you can ctrl+f find it in the css stylesheet (even the name of the stylesheet is mentioned in these tools).

Explanation on how to do that, here (firefox): http://www.w3resource.com/web-development-tools/inspect-and-edit-HTML-and-CSS-with-Firebug.php or here (chrome): https://developers.google.com/web/tools/chrome-devtools/inspect-styles/edit-dom

I'm a big fan of Firebug and use it a lot.