HTML - <span> Tag


Advertisements


Description

The HTML <span> tag is used for grouping and applying styles to inline elements.

There is a difference between the span tag and the div tag. The span tag is used with inline elements whilst the div tag is used with block-level content.

Example

<!DOCTYPE html>
<html>

   <head>
      <title>HTML span Tag</title>
   </head>

   <body>
      <p>This is a paragraph <span style = "color:#FF0000;">
         This is a paragraph</span>This is a paragraph</p>
      
      <p><span style = "color:#8866ff;">
         This is another paragraph</span></p>
   </body>

</html>

This will produce the following result −

Global Attributes

This tag supports all the global attributes described in − HTML Attribute Reference

Event Attributes

This tag supports all the event attributes described in − HTML Events Reference

Browser Support

Chrome Firefox IE Opera Safari Android
Yes Yes Yes Yes Yes Yes

html_tags_reference.htm

Advertisements