14

What is better in terms of SEO ?

<div class="box1" >
      <p> A bunch of text right here</p>
</div>

or

<div class"box1" >
A bunch of text right here
</div>

box1 div has a lot of css applied, so in order to make the text look like/where i want i will wrap it in that div . this div in particular only has text . But for SEO purposes is it better to use the p tag inside the div or just use the text directly in the div ?

The result is the same ( visually ).

PS: i understand that the general idea is that p is more relevant for seo than div ( or at least this is what i heard. please correct me if i am wrong here) . But in this case my text on this page will be shown in different containers on the screen for a better look. should i use the text inside the div or should i use the text inside the p tag and the p tag inside the div for better SEO ?

7 Answers 7

18

Between two options, there is no difference for SEO. By the way, your question is not about SEO but it's about HTML semantic.

To respect the HTML semantic and unlike you think, the <p> tag exists for displaying paragraphs of text, not text. But in general, texts are displayed in a page through paragraphs. That's why you can use <p> tag inside a <div> HTML element but semantically, it's not an obligation.

Therefore, my answer to your question is: there is no difference for SEO, just use <p> inside a <div> element if your text is cut into paragraphs.

9
  • 3
    your answered my question and i also learned something new. Thanks for helping a newbie :)
    – ClawDuda
    Commented Mar 31, 2014 at 13:44
  • 2
    There is no difference for SEO or, to put it more cautiously, there is no known reason why the p markup would matter. The question was about SEO. There is no reason to raise the question about “semantics” here, and it would be a very misty topic; e.g., HTML5 has its own ideas of p, which might be seen as rather different from HTML 4 (and w3schools is about the worst place to consult in this matter, or others). Commented Mar 31, 2014 at 14:36
  • 1
    Please, use a better source for documentation: while w3schools is correct in this case, I'd be wary to share their links. I'd use this, from MDN: developer.mozilla.org/en-US/docs/Web/HTML/Element/p
    – STT LCU
    Commented Mar 31, 2014 at 14:39
  • 1
    Ok guys, I changed the link to www.w3.org.
    – Zistoloen
    Commented Mar 31, 2014 at 14:43
  • 1
    When w3schools gets it wrong, don't link to them. When w3schools gets it right, don't link to them. That's strange logic.
    – Matt K
    Commented Mar 31, 2014 at 20:21
2

First, I would take all those <p> is more relevant for SEO than <div> with a big grain of salt. SEO really only cares about content relevancy. Putting text in a <div> or in a <p> is not something you should be tweaking. Just go to what is the natural use.

<div> pretty much means 'this is a section of content' while <p> is 'this is a paragraph'. Personally, I just use <div> as it has no internal formatting in any browser, while <p> has some browser-specific formatting (margins, etc.) that can make things look different depending on the browser (unless you use a CSS 'cleaner'). Also, <p> inside <div> adds HTML which makes the pages a bit bigger, and thus, less pages would be crawled at once per crawler 'sweep'.

Worry about the content, not so much about how to write the HTML so search engines 'like it'.

2

To my knowledge it does matter, for a very simple reason:

A div is short for division, just a part/block on your website, where paragraph is designed for text. In something like a news article, a paragraph's first sentence is important(at least in Dutch language). It has vital information about what that paragraph is about (just think about it, every time you start a new sub-subject, you create a new paragraph where the first sentence is important).

I've been to a Google course, where the 'expert' told us about this principle and that Google that same trick (See, first sentence of new paragraph is important). With that in the back of you mind, it does differ if you use a div or p. Will it increase/decrease you pagerank by 8? No. But the devil is in the details.

Also, you get points for using sementic html. Using P's for paragraphs would help this principle.


In your example you miss the 3rd, and IMO the proper solution:

<p class="box1"> A bunch of text right here</p>

You remove the div and give the class to the paragraph. It does matter how you use your html. Unneeded elements will make the page slow(er), which affects PR.

1

The use of p tag matters! Apart from other occasions, I have seen that when there is no meta description for the page and Google creates one by default, it uses whatever element looks more like a text.

Example: I had a page, in three languages (three different domains) with only a meta title. In Google search results the meta description was the navigation alphabet I was using for the categories on that page, not the text above! (the alphabet was inside h2 tag for font styling purposes). I included the text inside p tag, went to Google Search Console, asked to index the URLs and the next time I checked on Google search results I could see the first 2 lines of my text (in all three domains). Without adding any meta descriptions.

P.S. In case of a broken page the text will be still shown if it is inside a p tag. Otherwise...chaos.

Trust me; I have learned from my mistakes.

0

No difference from SEO perspective. However, HTML semantics & performance should be taken into consideration. Unnecessary HTML tags also impact performance.

1
  • Please pay attention of posting an answer with additional information in relation to these already mentioned in other answers.
    – Zistoloen
    Commented Apr 3, 2014 at 11:08
0

Absolutely no difference from SEO perspective. Both are same! The way SEO pages function is that they will give more priority to the tags such as h1, h2 ..etc. 'div's are just block level elements used for the HTMLisation purpose. It offers no contribution to SEO optimisation.

From the point of semantics , it is important to avoid such glitches that can hamper the processing of the DOM by the browser

-3

Generally, SEO gives importance only for header tags (<h1>, <h2>, <h3>, <h4>, <h5> and <h6>). So no need to worry about <p> and <div> tags.

1
  • 1
    I think you need to brush up you SEO knowledge, seems like you're throwing away a lot of (easy) points :)
    – Martijn
    Commented Apr 1, 2014 at 13:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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