Styles in HTML

The Style in HTML is used to format the html document with required style information specified in head section.

Styles in HTML

Styles in HTML

     

The Style in HTML is used to format the html document with required style information specified in head section.

Understand with Example

To set the entire text of a HTML document to one style(e.g., color), we use the following code:

Example: Styles in HTML
<html>
<head><title>Use of Styles in HTML</title></head>
<font size=10 color="yellow";>
The entire texts in the Body<br> of the Document will be in <br>yellow color
</body>
</html>

Output is displayed as

 

Inline Style:

When we have to use different style format in a specific paragraph or in a particular line of the document, then we use the following code:

 

<html>
<head><title>Example on the use of inline Styles in HTML</title></head>
<body bgcolor="black" Style="color:Lightblue">
<p style="color: orange">The color of the text in this line is red except <span style="color:yellow">the inline specification</span> made for a particular line or a part of a particular line.</p>
</body>
</html>


Output shown in the Browser window will be like this- 

 

Download Source