As the title says, would it be better to wrap text using <div>
or using <p>
. Which woul开发者_StackOverflowd work better for SEO?
Semantically you should always use <p>
to hold any "content" text within the body of your page. Similarly, headings should always go in <h1>
, <h2>
etc. Only use <div>
for layout and positioning purposes (so for example as a wrapper around the main body of content, sidebars etc).
Search engines will typically rank pages using semantic HTML higher in their results as pages laid out in this way are more "machine-readable".
Div
always uses for styling and decorating the form so that it is not a useful element to wrap texts. in a well-formed & standard html tag, you have touse p
to show the search engine or whoever, that you are displaying a paragraph or your are writing some text
It is not a command but a best practice which you need to follow for a better coding.
Do not use same element for same reasons. each one has one destiny.
Search engines crawl the page and look for semantic structure and determine a logical hierarchy for your content.
<h1>
tags are treated different to <h2>
, <h3>
and so on. a <div>
tag would put your content on par with other content within other div
tags.
I'd choose <p>
over a <div>
if the content is 'important', relates to what your website is about and has a chance to contribute towards your SEO.
You should always use the right tag for the job.
<div>
is used to divide the page into logical sections. <p>
is for paragraphs of text. <h1>
through <h6>
are used for headings. <ul>
and <ol>
represent lists of data. <table>
and it's children are for tabular data. <form>
is for forms and so on.
Working this way has benefits for SEO because the search engines know what sort of data they're reading and can rank it's importance accordingly. It also gets you a good way towards improving accessibility (e.g. screen readers will often build a page outline based on heading structure). More importantly for you, it makes it a lot easier to style your website consistently.
It doesn't make a difference for SEO as far as I'm aware, p
will be just fine.
Semantically, p
is supposed to represent a paragraph and div
an arbitrary (sub)division - practically, however, the distinction between the two is fuzzy, and certainly won't matter for SEO purposes.
you should use one of them if you are using <P>
than don't use wrap
these both are same and no one is better for seo because html and css code don't have mean for seo.
if html tags or css name can make site better than seo have no mean because about all site have html tag. that sure alt
and title
can make your site according seo.so you should use one of them according you.<p>
or wrap
As long as only word wrap is concerned, they are the same. you can set CSS attribute of word-wrap with break-word to force word wrap, see a cross browser solution here. you can even do word hyphenation or justification using this lib .
Regards.
p
will be fine/
but i prefer using that in html5 tagging/
header, nav, section, aside etc./
精彩评论