Style-Tag

The <style> tag in HTML helps us to modify our text, viewed in the page. This modification includes changing font size, font family, font color etc. Not only the texts but also we can change the style of a body or part of a page. Now let’s look at various attributes of style and what else the tag supports.

Syntax

<tagname style="property:value">

1) The tagname includes <p>, <body>, from <h1> to <h6> etc.
2) The property is borrowed from CSS like color, font-size, font-family etc.
3) The value is also borrowed from CSS.

1) color-property

Example

<html>
<head>
<title>style</title>
</head>
<body>
<p style="color:green">HTML-hyper text markup language </p>
<p style="color:blue">HTML-hyper text markup language </p>
<p style="color:pink">HTML-hyper text markup language </p>
<p style="color:aqua">HTML-hyper text markup language </p>
</body>
</html>

Output

HTML-hyper text markup language

HTML-hyper text markup language

HTML-hyper text markup language

HTML-hyper text markup language

2) Font-Family

Example

<html>
<head>
<title>style</title>
</head>
<body>
<p style="font-family:monotype corsiva">HTML-hyper text markup language </p>
<p style=""font-family:algerian">HTML-hyper text markup language </p>
</body>
</html>

Output

HTML-hyper text markup language

HTML-hyper text markup language

3) Font-size

Example

<html>
<head>
<title>style</title>
</head>
<body>
<p style="font-size:10px">HTML-hyper text markup language </p>
<p style="font-size:0.5in">HTML-hyper text markup language </p>
</body>
</html>

Output

HTML-hyper text markup language

HTML-hyper text markup language

4) Text-align

Example

<html>
<head>
<title>style</title>
</head>
<body>
<p style="text-align:left">HTML-hyper text markup language </p>
<p style="text-align:center">HTML-hyper text markup language </p>
<p style="text-align:right">HTML-hyper text markup language </p>
</body>
</html>

Output

HTML-hyper text markup language

HTML-hyper text markup language

HTML-hyper text markup language