Span Tag In HTML


Span Tag In HTML

<SPAN> tag is used to provide additional structure to HTML document. It is used to group and apply styles to inline elements. It can be used to give different characteristics to specific parts of other elements. The HTML span element begins with <SPAN> tag and ends with </SPAN> tag. A style can be applied to the content placed inside the SPAN tag using STYLE attribute.

Example

<P>This is a paragraph
<SPAN STYLE="color:#FF0000;">This is a paragraph</SPAN>
This is a paragraph</P>
<P><SPAN STYLE="color:#6600ff;">This is another paragraph</SPAN></p>

Now take a look at the practical of this article.

Practicle


Open Notepad and type the following code:

<HTML>
<BODY
<P STYLE="text-align: 'center'; font: "16pt courier'; color: 'blue'">
The color of the sky is blue, but if you look at the <SPAN STYLE="color: 'green'"> trees, they
are green</SPAN>. </P>
</BODY>
</HTML>

Save the file as Span html"
Double click the file. The web page will appear in the browser.

Span Tag In HTML