Skip to content

Instantly share code, notes, and snippets.

@tiller1010
Created October 7, 2024 21:13
Show Gist options
  • Select an option

  • Save tiller1010/dcf9071d6e7d2b1fd8db9f2b32bd73f6 to your computer and use it in GitHub Desktop.

Select an option

Save tiller1010/dcf9071d6e7d2b1fd8db9f2b32bd73f6 to your computer and use it in GitHub Desktop.
Argument for inline css vs sass compilation

There are a few cases where inline styles would be more appropriate than using SASS or CSS.

  • Styling is done in one file, vs adding a class, opening a sass file, and compiling it to css.
  • Styling is explicit, no guesswork needs to be done to determine what styles a class would add.
  • Style rules are strong, nothing besides !important rules will conflict with them.
  • Styles are brief, and the need to come up with a name for a class is avoided.
  • Sometimes we just want to add one or a few styles, and a css class would be overkill.

There are cases where sass works better.

  • If you need to add 3 or more styles, a class looks cleaner than inline styling does.
  • If it is something that is going to be re-used often like in different parts of the project, a class is more appropriate. Doing the styles inline would force you to edit each line to make a change.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment