↓ Ir para o conteúdo principal

← todas as notas

📎 Webclip

8 SCSS Best Practices to Keep in Mind

The post presents eight SCSS guidelines taken from a company coding guideline and frames them as useful for both collaborative work and personal projects. It focuses on writing CSS that stays readable, maintainable, and easier to scale.

Reading notes
#

  • Mobile-first styling is preferred so responsive design starts from mobile and expands upward with min-width media queries.
  • Variables and mixins should be set early, especially for values like border radius, colors, fonts, margins, and transition timing.
  • #id selectors and !important are treated as overly specific and discouraged because they can complicate CSS order in collaborative work.
  • Magic numbers should be avoided in favor of relative values that explain why a number is needed.
  • Selector names should describe hierarchy or purpose rather than only visual appearance.
  • Zero values should follow the project’s consistency rules, including units for zero-duration times, no units for zero-length values, and a leading zero for decimals.
  • Comments should be placed above the property they describe, and inline // comments are preferred over block comments.
  • Media queries should stay at the root of the declaration instead of being nested inside each selector, so they are easier to find.