Introduction:

In this article we are going to explain what is style attribute in html or how to set style like color, background-color, text-align, font-family, font-size in html element with example.

Description:

HTML Style is used to change or add the style of HTML elements. There is a default style for every HTML element e.g. background color is white, text color is black etc.

The style attribute can by used with any HTML tag. To apply style on HTML tag, you should have the basic knowledge of css properties e.g. color, background-color, text-align, font-family, font-size etc.

You can easily edit background color, text size, text color and text alignment of any document using HTML text style tags.

HTML text style tags use the following syntax:

 <tag name e.g. p, div etc.  style = “property:value;”

The syntax of style attribute is given below:

style"property:value"

Let's see an example of HTML style attribute.

<!DOCTYPE html>
<html>
<head>
    <title>Example of style attribute </title>   
</head>
<body>
    <p style="background-color:yellow; color:blue; font-family:Verdana">
    This is a background color change example
    </p>
</body>
</html>

Output:

 

I hope this article will help to you after reading.

0 comments


Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

you may also like