Computer >> Computer tutorials >  >> Programming >> HTML

How do we style HTML elements using the span tag <span>?


To style HTML using span, use the <span> tag. It is used to group and applies a style to inline elements. The HTML <span> tag is used for grouping and applying styles to inline elements.

The span tag in HTML is used with inline elements. Let us see how to use it.

How do we style HTML elements using the span tag <span>?

You can try to run the following code to learn the usage of a <span> tag. Here, we will be using the <span> tag inside the <p> tag.

Example

<!DOCTYPE html>
<html>
   <head>
      <title>HTML span Tag</title>
   </head>
   <body>
      <p>Java is a Programming language widely followed. <span style = "color:#FF0000;">
         Developed by James Gosling. </span>This is demo text.</p>
      <p>
         <span style = "color:#8866ff;">
            Current Version: 1.8 </span> </p>
   </body>
</html>