Mobile app version of vmapp.org
Login or Join
Shakeerah822

: Will enclosing an element inside a element affect SEO? Is it okay (SEO-wise) to construct the following line as such: <p>These are the best <h1> Cheap Widgets </h1> ever.

@Shakeerah822

Posted in: #Html #Seo

Is it okay (SEO-wise) to construct the following line as such:

<p>These are the best <h1> Cheap Widgets </h1> ever. </p>


Wondering if this looks too unnatural for search engines?

10.04% popularity Vote Up Vote Down


Login to follow query

More posts by @Shakeerah822

4 Comments

Sorted by latest first Latest Oldest Best

 

@Odierno851

There are definitely other reasons to do that (as mentioned in the other replies here), but it won't negatively affect your site's "SEO" compared to using the same text within a h1 outside of the p. FWIW just randomly placing keywords from your site within h1 elements isn't going to impress any modern search engines, it really makes sense to use them in a semantically correct way.

10% popularity Vote Up Vote Down


 

@Bethany197

You cannot enclose h1 in p. It’s not just a matter of HTML rules; it’s also how browsers and search engines process the markup. Your example will be parsed as if it were

<p>These are the best </p><h1> Cheap Widgets </h1> ever. </p>


That is, one p element, followed by one h1 element, followed by just text not wrapped in an element, and then the syntactically incorrect and unexpected eng tag </p>, which will be ignored. This also affects styling. E.g., if you set p { font-family: Cambria }, it will affect the text “These are the best” only.

There’s really not much point in such trickery. People who develop search engines are generally smarter than people who try to fool them, though admittedly some tricks may work for some time.

10% popularity Vote Up Vote Down


 

@Deb1703797

Additionally: It will, because Google structures information through headlines (generally through semantic markup, because it has no other means to do this). Therefore, you mess up the structure of your document by nesting a h1 in a p. Otherwise, you also distract people with screenreaders. And: what exactly is it supposed to mean, having a h1 by itself in a p? The headline has absolutely no context, and you have your document root headline somewhere in the middle of nowhere.

Solution, if you really don't like the h1 anywhere else: <h1 style="display: none"></h1> although this has other negative implications for your SEO.

10% popularity Vote Up Vote Down


 

@Ravi8258870

According to the W3C, the P element can only contain other elements as listed here: Phrasing Elements.

Therefore, that is syntactically incorrect and may result in a browser error (check Firefox's console). It's recommended to validate your HTML code before submitting to search engines, so I'd suggest avoiding code that may produce errors or looks unnatural.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme