HTML Styles

HTML Introduction

HTML Forms

HTML Graphics

HTML Media

HTML API

HTML Styles

The HTML style attribute adds style to an element, such as color, font, size, and more.

The HTML style attribute has the following syntax:

<tagname style=”property:value;”>

The property is a CSS property. The value is a CSS value.

Example

				
					<!DOCTYPE html>
<html>
<body>
<p>I am normal</p>
<p style="color:red;">I am red </p>
<p style="color:blue;">I am blue</p>
<p style="font-size:50px;">I am big</p>
<p style="font-size:160%;">This is a paragraph.</p>
<p style="background-color:powderblue;">This is a text</p>
<p style="font-family:verdana;">This is a text</p>
<p style="text-align:center;">Centered Heading</p>
</body>
</html>

				
			

Output:

I am normal

I am red

I am blue

I am big

This is a paragraph.

This is a heading

This is a heading

Centered Heading