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

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
231,236 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

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.