Intelligence Community Design System ICDS Get started Accessibility Styles Components Patterns Community
Show navigation section

CSS and inline styles

Introduction

Write CSS in a way that can be overridden by the user via their browser.

Don't use inline styles; keep CSS separate to the HTML. This can be a separate CSS stylesheet or via other techniques like CSS-in-JS.

Decoupling the styling will create more flexibility as the visual styling can be updated without touching the HTML.

Don't use!important on a style declaration as this overrides any other declarations. You can read more information from Mozilla on importance exception .

When it goes wrong

Both inline styles and!important will override user-defined styles that can be set using browsers and assistive technologies.

Assistive technologies and users may change browser default styles to improve accessibility. For example, users with visual impairments or dyslexia may increase the font size or override colours.


Last reviewed 18 April 2024 .
Navigated to CSS and inline styles - Intelligence Community Design System