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 CSS Basics Getting Started with CSS Adding CSS to HTML: Internal Styles

Dustin Virts
Dustin Virts
1,879 Points

If in-line html styling is not recommended and accepted practices are to use a css stylesheet, then why train on this?

If in-line html styling is not recommended and accepted practices are to use a css stylesheet, then why are their training steps to learn how to do this? it literally says that doing it this way is not recommended... but here is how you do it anyway. So strange.

2 Answers

Steven Parker
Steven Parker
216,891 Points

There are situations where in-line styling can be very useful, such as:

  • for a quick, temporary test of a style that will be implemented more conventionally later
  • when the CSS file is not editable or has been minimized
  • when the CSS is being managed by a framework that should be left intact
John Kennedy
John Kennedy
2,929 Points

Adding on to Steven's response:

It is also important to be able to recognize and understand inline styling should you encounter it in another developer's code so that you can respond to it effectively when styling and making adjustments. For example, if you notice that the CSS styles are being overridden by the inline styles in the html you could make the necessary changes to accomplish your goals.