Inline Style
Written by Andy Sim
Last updated
An inline style is a piece of CSS written directly inside an HTML tag, so that it affects only that one element.
For example, a paragraph tag can carry style="color: red". It is quick for a one-off change, but it makes pages harder to maintain because the same style is repeated in many places and it can override the main stylesheet. Most developers keep styles in a stylesheet and use classes instead.
Examples
- A single heading coloured differently from the rest.
- A quick fix to a button's spacing on one page.
- Email templates, which often need inline styles to display correctly.
Why it matters for your website
A few inline styles do no harm, but many make a site slow to change and inconsistent. Ask your developer to keep the design in the stylesheet so that updating a colour or font is one change, not hundreds.