Avoid Using Inline Styles

A Warning

There is no good reason to ever use inline styles when you have CSS. If you ever think to yourself, “I’ll just add this one style, I’m not going to use it anymore,” tell yourself, “NO!”

Trust me on this – my first sheet is riddled with inline styles precisely because of this impulse, and now they are there, it’s a lot of work to remove them and tidy up the sheet.

Conclusion

CSS gets way more complex than this (look up selectors and specificity for example), but this is hopefully a good introduction.

Using CSS over style gives a lot of advantages. It simplifies your code, makes it easy to make changes, and you can reuse class names anywhere in your code and target HTML very precisely by using inheritance (those nested tiers).

Use CSS, not inline styles. You’ll be very happy you did, later on.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.