bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/CSS/CSS Foundations
CSS•CSS Foundations

How To Add Inline CSS

Concept visual

How To Add Inline CSS

Graph traversalgraph
ABCDE
current
queued
1
4

Start from A

Inline CSS

An inline style may be used to apply a unique style for a single element. To use inline styles, add the style attribute to the relevant element. The style attribute can contain any CSS property.

Example

Inline styles are defined within the "style" attribute of the relevant element: <!DOCTYPE html> <html> <body>

<h1 style="color:blue;text-align:center;">This is a heading</h1>
<p style="color:red;">This is a paragraph.</p>

</body> </html>

Tip:

An inline style loses many of the advantages of a style sheet (by mixing content with presentation). Use this method sparingly.

Previous

How To Add CSS

Next

Multiple Style Sheets & Cascading Order