1

What I want to do is

<div>some text <span>different text</span> more text </div>

I wasn't sure if I needed one of <a><p><h1> tags to use text or if I could simply just write it with just div.

Does it affect proper markup or SEO?

Also in cases where I am using the header tags <h1><h2>, etc. How many can I go up to? Such as <h7>+? And just wondering, can I use the same heading as many times as necessary right? As in, if I declare <h1> to have some font declarations can I use it multiple times on a page?

4
  • 1
    What do you man by 'need'? You don't need any tags, text just 'works' byitself... Commented Jun 19, 2010 at 8:23
  • i wasnt sure- every time ive seen text its always had the (a) or (p) tags on it- so its perfectly fine to just say (div) text blah blah(/div)? Commented Jun 19, 2010 at 8:26
  • What does this text represent is it a paragraph a list a header? You could use plain text as inflagranti says but for a best practice (both in coding and SEO) you should strive to add semantic markup to your text. Commented Jun 19, 2010 at 8:26
  • 1
    To format text as code or markup, select it in the editor and press Control-K. Commented Jun 19, 2010 at 8:31

3 Answers 3

2

Divs will be fine, but they are not particularly descriptive, neither is span.

Allways try to use the tag that best describes the content. eg. use

for a paragraph of text, for some important information etc...

Try to reserve for things like layout, a thing that carries no real information.

Sign up to request clarification or add additional context in comments.

Comments

0

Just text without any formatting, without any position, without anything, just text (which will look very bad and completely NOT USER friendly, like this answer!) divs are okay.

You may even just write the text. There is no need to put divs if there is no need of formatting of any kind.

Comments

0

DIV and SPAN are used for grouping. You should still have semantic markup like P for paragraphs or H1 through H6 (that's as high as it goes) for headings. Just worry about semantics and well-formed documents; SEO will take care of itself if you do those two things (and have useful content of course).

People use the A (anchor) tag a lot for different reasons. Mainly it's because HTML stands for HyperText Markup Language—the "hyper" connotes the incorporation of additional content/media/features compared to plain text documents. One of the biggest distinguishing characteristics of hypertext documents is the ability for one document to link to another using hyperlinks—this are created with the A tag.

The A tag can also be used to link to different sections of the same document or another document. These points are specified by the A tag as well, like so:

<p><a name="top">Hello World</a></p>
<p>Blah, blah, blah.</p>
<div><a href="#top">Back to top</a></div>

Additionally, anchors can also be created using the ID attribute, which can be used in almost any tag:

<h2 id="ToC">Table of Contents</h2>
...
<p>View the <a href="#ToC">Table of Contents</a>
to see all sections of this guide.</p>

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.