Bhylu

HTML Styles

An inline style applies CSS declarations to one element. It is useful for understanding how a property works, but repeated inline styles make a larger site difficult to maintain.

How it works

  • A declaration pairs a CSS property with a value using a colon. Separate declarations with semicolons.
  • The color property controls foreground text; background-color controls the element’s background. These are CSS properties, not HTML attributes.
  • Inline styling is tightly coupled to the element. Prefer classes and a stylesheet when the same design appears in more than one place.

A practical example

HTML

<p style="color: #164e45; background-color: #edf8ef; padding: 1rem;">
  The workshop entrance is on the garden side.
</p>

In a normal browser page, the paragraph has dark green text, a pale background, and internal spacing. Bhylu’s restricted preview intentionally removes inline style attributes; use a local file for this exact example.