Include CSS in HTML Document

Include CSS in HTML Document

CSS stands for Cascading Style Sheets and the language describes HTML tags, furthermore, it eliminates the repetition in making HTML tags stylish. Moreover, it would be better to give examples that can make you better understand.
To include CSS styles tag is used.
Here I will explain using heading tag h2
Heading tag h2
<h2> This is the first h2  green heading. 
For the second an third we have to repeat the same
<h2> <span style=”color: green;”> This is the second h2  green heading.  </span></h2>
<h2> <span style=”color: green;”> This is the third h2  green heading.  </span></h2>
The out of the above three statements would be:

This is the first h2 green heading.

This is the second h2 green heading.

This is the third h2 green heading.

____________________________________________________________________

Using style tag we can write

<style>
h2
{
color:green;
}
</style>
And only the statements within the tags
<h2> This is the first h2 green heading which uses CSS</h2>
<h2> This is the second h2 green heading which uses CSS</h2>
<h2> This is the third  h2 green heading which uses CSS</h2>
And the output will be:

This is the first h2 green heading that uses CSS.

This is the second h2 green heading that uses CSS.

This is the third h2 green heading that uses CSS.

So, you can see that we do not need to write style=”color: green; in every tag so repetition and complexity is eliminated.

Leave a Comment

Your email address will not be published. Required fields are marked *

©Postnetwork-All rights reserved.