The style attribute places CSS declarations directly inside the HTML element you want to change. It is the quickest way to test a property, but its effect stays limited to that one element. section 7.2 section 2.3
Build the value from property–value pairs:
- Wrap the declarations in quotation marks: <element style="property: value;">. section 7.2
- Separate multiple declarations with semicolons, and add a space after each colon to keep the code readable. section 7.1 section 7.2
- Use single quotation marks inside the attribute when a CSS value itself needs quotation marks. section 7.2
A paragraph and a list with inline styles
<p style="font-size: 1.5em">A larger paragraph</p> <ul style="color: darkgreen; font-size: 1.25em;"> <li>One item</li> <li>Another item</li> </ul> The paragraph and list receive different styles because each style attribute affects only its own element. section 7.2
Inline styles become awkward when many elements need the same design: every element needs its own attribute, and later changes must be repeated. Class selectors, internal style sheets, and external style sheets scale better. In the cascade, inline styles outrank internal and external author style sheets when rules conflict. section 7.2 section 19.13 section 7.7






