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

HTMLWeb DevelopmentFront End Technology

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.

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

Live Demo

<!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>
raja
Published on 01-Feb-2018 13:20:34
Advertisements