Elyas Aktaou
Elyas Aktaou

Reputation: 38

split H1 in 2 colors

I have to apply a different color to just a part of my main heading. It is just one word.

<h1>HEA<span class="red">DING</span></h1>

That's what I have now, but I'm concerned about my code being as semantically correct as possible. Is there any more correct way to do this?

Upvotes: 1

Views: 1000

Answers (1)

Ramiz Wachtler
Ramiz Wachtler

Reputation: 5683

According to MDN | Heading elements the permitted content of heading elements is phrasing content and <span> tag belongs to the category phrasing content.

EDIT

It will not have any negative effect on your SEO. A <span> tag is not a semantic markup.

Upvotes: 1

Related Questions