Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

If I have a page with an <h1> heading and a long paragraph, is it ok to write the paragraph (see below - with the h tags mixed with broken p tags to make up the whole block of text) and just style it so it looks all the same so that I get the benefit of using <h2> and <h3> tags?

I'm aware this is not the 'proper' use of the H tags as they're meant to be headings but can I use them like this, as the site isn't built using multiple headings on the same page?

<h1>Red shoes</h1>

<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus id dui id mi 
consectetur tincidunt. Mauris at sem non urna congue eleifend sed quis nulla. Aenean nisl
porta eget auctor vel, semper eget massa.</p> <h2>Red shoes</h2> <p>Lorem ipsum dolor
sit amet, consectetur adipiscing elit. Phasellus id dui id mi consectetur tincidunt.     
Mauris at sem non urna congue eleifend sed quis nulla. Aenean nisl porta eget auctor vel, 
semper eget massa.</p> <h3>red shoes</h3> <p>Lorem ipsum.</p>

(please ignore over optimization this is just for illustrative purposes)

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

It's a very bad idea for accessibility reasons as well.

One commonly used feature of most screen readers is the ability to have a list of headings read out. This gives the users an overview of the document's structure and means they can jump between sections they want, rather than having to read through each section.

In your example, the headings would make no sense when taken out of the surrounding text. Also a user could jump to a H2 and it would land them in the middle of a sentence, which you don't want.

As mentioned above, it's also breaking the rules of HTML by nesting block elements, and completely ruining any semantic structure your page may have.

As far as Google is concerned, I'm pretty sure they'd consider it a Black Hat technique. Remember: Google indexing may be done by computers/algorithms, but those algorithms are programmed by people (and they're not stupid)

share|improve this answer
add comment

Either your question is wrong, or the code sample is.

Question wrong:
Your code sample doesn't show the Hx tags actually in the paragraph. They're just alternating, and each self-contained. So, in this case, there's nothing wrong code-wise, but your question makes no sense since it doesn't even apply to what you're showing us. (If you created that sample in an HTML editor, it's possible that it just corrected it for you automatically and you didn't notice.)

Sample wrong:
If we assume that your sample is supposed to be something like

<h1>Heading</h1>
<p>Some regular text <h2>some text in an Hx tag</h2> and some more regular text</p>

...then that's just not allowed. You can't put heading tags inside paragraph tags. They're both block elements. It won't validate, might cause rendering errors, mis-application of CSS rules, possible problems with your content being spidered properly, and so on.

share|improve this answer
    
i wrote the example by hand inside of stackexchagne, i remembered while writing it you could have the h tags actualy in the p tags so i broke them up, what i meant was will google still read the 'tag sandwhich' as one sentence ? Ill edit the question to make it clearer –  sam Jun 7 '12 at 0:26
add comment

It's questionable, and may not be semantically correct. Imagine if Google recognized the first instance of an h1, and then expected the next header to be an h2, then h3 and so on. If you start throwing in header tags through out your page it may not be to hard to detect. You may just lower the trustworthiness of your web page, as well as the other correctly placed header tags. You are better off in my opinion and i'm sure Googles to write the content and code your site properly. You time is better spent building contextually relevant backlinks to that page to increase its rankings than hoping a few hidden header tags will help

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.