What are the CSS guidelines I should be aware of?

Modified on Wed, 29 Jul at 1:06 PM

  1. Use tag-based styling instead of styling based on specific elements in the source code (such as spans, divs, and a-elements). Always start with as few tags as possible to prevent everything from getting very heavy. Body tag, section tag, or component tag, followed by the item you're customizing.
  2. If you want to add styling to a component, you don't have to use the standard HTML structure of a page. Always tag if it is a reusable part.
  3. Do not set a fixed width for the columns and sections of the site structure. This is not accessible.
  4. Use CSS variables for colors and fonts and sizes defined in the top of the CSS file.
  5. Do not create a separate section for breakpoints. They should be set just after the class .
  6. Do not use a specific component ID for styling, such as #paddle_components_list_block_15e7ef7d-7119-4b55-81bb-a1f174ad56ba
  7. Do not style on ID like this: #field_block\:node\:faq_list\:faq
  8. Styling for the components or sections of the site (such as header, footer, banner, etc.) should not be scattered in the SASS/CSS file. If the header is styled, all styles related to the header section should be in one place. This way the code remains structured and is easy to maintain/update. Moreover, the reusability can be used to the maximum in this way.
  9. Add your changes at the bottom of the CSS file so that it is clear which changes you have made OR place a clear subtitle so that we can quickly recognize which code still needs to be updated in our central file.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article