HTML » HTML Core Attributes » style

Version: 4.0


The style core attribute is used to create an inline set of style rules that define the appearance and presentation of text and images for a specific element. This is a convenient method for applying the effects of Cascading Style Sheets to a select portion of an entire HTML document. As a consequence, this core attribute is extremely useful.

Do not confuse this attribute with the style tag which is placed in the head of an HTML document and can be used to assign a set of style rules that affect the entire page or any portion.


<span style="color: orange;">DevGuru</span> products are great!
DevGuru products are great!

In this examples, an inline style script is first used to set the color of the word DevGuru.

Language(s): HTML
<span style="font-size: 2px;">a</span>
<span style="font-size: 4px;">a</span>
<span style="font-size: 6px;">a</span>
<span style="font-size: 8px;">a</span>
<span style="font-size:10px;">a</span>
<span style="font-size:12px;">a</span>
<span style="font-size:14px;">a</span>
<span style="font-size:16px;">a</span>
<span style="font-size:18px;">a</span>
<span style="font-size:20px;">a</span>
<span style="font-size:22px;">a</span>
<span style="font-size:24px;">a</span>
<span style="font-size:26px;">a</span>
<span style="font-size:28px;">a</span>
<span style="font-size:30px;">a</span>
<span style="font-size:32px;">a</span>
<span style="font-size:34px;">a</span>
a a a a a a a a a a a a a a a a a

This example uses the span tag to grow the size of the letter a.

Language(s): HTML