Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it valid to put h2 tag in span tag?

Tags:

html

seo

Is it valid to put h2 tag in span tag given that the span tag is displayed as block?
would it make difference for search engines (SEO) if i used div instead

like image 824
hfsyria Avatar asked Dec 22 '22 07:12

hfsyria


1 Answers

Sample input:

<!DOCTYPE HTML>
<html>
    <head><title></title></head>
<body>
    <span style="display: block">
        <h2>A</h2>
    </span>
</body>
</html>

And results from W3C validator:

Element h2 not allowed as child of element span in this context.

like image 83
Tomasz Nurkiewicz Avatar answered Jan 05 '23 20:01

Tomasz Nurkiewicz