Forum : About span tag
Brief description  about Online courses   join in Online courses
View Siddiqui Nadeem Ahmed 's Profile

About span tag

any body explain about span tag
Asked by Siddiqui Nadeem Ahmed | Jun 19, 2010 |  Reply now
Replies (1)
View teacher siliconindia 's Profile
Hi

<span>

The <span> tag has very similar properties to the <div> tag, in that it changes the style of the text it encloses. But without any style attributes, the <span> tag won't change the enclosed items at all.

The primary difference between the <span> and <div> tags is that <span> doesn't do any formatting of it's own. The <div> tag acts includes a paragraph break, because it is defining a logical division in the document. The <span> tag simply tells the browser to apply the style rules to whatever is within the <span>.

The <span> tag has no required attributes, but the three that are the most useful are:

style
class
id

Use <span> when you want to change the style of elements without placing them in a new block-level element in the document. For example, if you had a Level 3 Heading (<h3>) that you wanted the second word to be red, you could surround that word with

<span style="color : #f00;">2ndWord</span>

and it would still be a part of the <h3> tag, just red.

Regards
Jun 20, 2010