HTML Tutorials


Span

Now that you know the basics of CSS, we can introduce a new HTML tag! The <span> tag allows you to apply CSS in the middle of a line.



Code

<!DOCTYPE html>
<html>
  <head>
    <title>Links!</title>

    <style>
      .blue-txt{ color: blue }
      .red-txt{ color: red }
    </style>
  </head>

  <body>
    <p>Cherries are<span class="red-txt">red</span>.</p>
    <p>The ocean is<span class="blue-txt">blue</span>.</p>
  </body>
</html>

Result

Cherries are red.

The ocean is blue.