Chapter 8 - What is Span Tag in CSS?

An element which can be used Inline is called Span Tag. No line break is created when a span tag is applied in between the text. Spans are similar to Divisions but the main difference is line break.

Example of CSS CODING

 /* Here I am using for CSS IDs to create a  colorful string with the help of Span Tag*/


Now have a look on the HTML coding to use Span Tag to format a string.

Example of HTML CODING

 /* Here I am using SPAN Tag of HTML to make a colorful string background*/

 This is a text with<span   id="redbg">RED</span> Background.

 This is a text with<span id="greenbg">GREEN</span> Background.N

The output of above code will be as follows:-
This is a text with RED Background.

This is a text with GREEN Background.

In other words, spanning is used to format anything by using an inline code of stylesheet with the help of Span Tag. 

I hope this will clear the working of SPAN tag and difference with DIV tag.


Post a Comment