Is it really put the h2 tag in the span tag?

Can I put the h2 tag in the span tag if the span tag is displayed as a block?
will it matter to search engines (SEO) if I use div instead

+4
source share
3 answers

Input Example:

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

And the results of the W3C Validator :

The h2 element is not allowed as a child span in this context.

+8
source

No, you can’t. Accordind to HTML 4.01 / XHTML 1.0 dtd you can only include inline elements in the span tag. This is the following:

a, object, applet, img, map, iframe, br, span, bdo, tt, i, b, u, s, strike, big, small, font, basefont, sub, sup, em, strong, dfn, code, q, samp, kbd, var, cite, abbr, acronym, input, select, textarea, label, button, ins, del, script.

It is not possible to quickly check HTML 5, but don’t think that it is here.

+2
source

In HTML4, it is not valid to place a block element inside any inline element .

This changes in HTML5, where it is acceptable to place block-level elements inside anchor tags .

0
source

All Articles