Sobes.tech
Intern

How to change styles for the <span> element in CSS?

sobes.tech AI

Answer from AI

To change styles for a <span> element in CSS, you need to write a selector by the span tag and set the desired properties. For example:

span {
  color: red;
  font-weight: bold;
}

This code will make all <span> elements red and bold.

If you want to change the style of a specific <span>, you can use a class or id:

<span class="highlight">Text</span>
.highlight {
  background-color: yellow;
}

You can also apply inline styles directly in HTML:

<span style="color: blue;">Blue text</span>