Span tag in HTML

Span tag in HTML

The span tag in html: Define a Phrase with a span tag

The span tag in html is an inline element used to mark up a part of a text such as a sentence or a word or a character. The <span> element give the same benefits as the <div> element but <div> is a block-level element and  span tag is an inline element. The span element may contain only text content and other inline elements but you cannot put block-level elements such as headings tag, lists tags, Div tag, Semantic elements, etc between a span elements. you can put <span> element between Block-level elements.

Let’s get see to example of a span tag in html.

span element example

In the above example, there is no ‘Mobile Number’,PAN Number’, and ‘ID Number’ Elements but you can use a <span> element to give meaning to particular words. In this example, the Mobile Number, PAN Number, and ID Number is marked up as a span and Identify with id’s name as “myno”, “mypan“, and “myid“: So that you can change the look of these particular words by applying the style rule (CSS) with the help of  id’s name

See the example:-

span element with css example

See result:-

span example result