Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is <span></span> element? [closed]

Tags:

What is the purpose of the

<span></span> 

element? And where should we use it?

like image 528
MAC Avatar asked Jul 08 '09 05:07

MAC


People also ask

What is SPAN ></ SPAN in HTML?

<span>: The Content Span element The <span> HTML element is a generic inline container for phrasing content, which does not inherently represent anything. It can be used to group elements for styling purposes (using the class or id attributes), or because they share attribute values, such as lang .

Does span have a closing tag?

The span tag is a paired tag means it has both open(<) and closing (>) tags, and it is mandatory to close the tag. The span tag is used for the grouping of inline elements & this tag does not make any visual change by itself.

What does </ span ></ p mean?

A span is an unstyled inline tag. An important difference is that p is a block element when span is inline, meaning that <p>Hi</p><p>There</p> would appear on different lines when <span>Hi</span><span>There</span> winds up side by side.


1 Answers

From here:

Definition and Usage

The tag provides no visual change by itself.

The tag provides a way to add a hook to a part of a text or a part of a document.

When the text is hooked in a span element you can add styles to the content, or manipulate the content with for example JavaScript.

So, the short version is, it's to style some text (without a paragraph or linebreak which is different from <div> tag)

like image 97
Xn0vv3r Avatar answered Sep 29 '22 18:09

Xn0vv3r