Forum Moderators: open

Message Too Old, No Replies

help with h tags and validation

         

amythepoet

12:31 pm on Jul 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

I would like some help with headers tags on my first page please.

Now, I have two h2 tags and I believe that is wrong, but I am trrying to get people's attention so I would like to make the text stand out.

Maybe if the second h2 tag was a bit smaller, it would be fine too.

Please advise.

Thanks

-a-

steelegbr

12:45 pm on Jul 18, 2004 (gmt 0)

10+ Year Member



Use h3 tag rather than the second h2 tag.

W3C state that (not quoting directly here) header tags are not for attracting attention but should follow the order for the page. E.g. h1 then h2...

tedster

12:55 pm on Jul 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Multiple H2 tags can be OK, too - if the two sub-headings carry equal weight semantically. If the second is really a sub-topic of the first (rather than an equal weight sub-topic for the entire document) then H3 is the way to go.

If you think about an outline with indents, you'll be on the right track.

H1 - Main topic (headine, subject, whatever you call it)
H2 - All the "sub-topics" that are indented once
H3 - Doubly indented sub-sub-topics

...etc

You can use css to style the appearance of any H tag any way that works for your pages. It's important not to think of the H tag in visual terms - it has only semantic implications. You can even create several classes for size, color etc and apply a difference class to a different H tag if that's what you need visually. Just keep the semantic relationshiops straight.

amythepoet

1:11 pm on Jul 18, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks very much everybody. I did make a h2 header and a h3 header as you have suggested and I hope it works.

I also changed the title to reflect the keywords.

I think I am on the right track.

I liked the analogy about the outline, thank you

Amy

g1smd

9:54 pm on Jul 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Run the site through [validator.w3.org...] and specifically tick the show outline box.

On the results page, scroll down past the error list (if there is one) to the section marked "Document Outline". If the list there does not look like a summary of your document then you are abusing the heading tags.

amythepoet

10:15 pm on Jul 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks so much for your advice. I will run it through the checker like you said,

Much appreciated,

-a-

amythepoet

10:26 pm on Jul 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Dear g1smd,

I just ran two url's through the validation checker you sent. One went through fine and passed!

The one though, has some problems and I don't know how to fix them.

Coudl I ask for your help?

Thanks

-a-

tedster

11:48 pm on Jul 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Amy, this forum loves to fix validation errors - it usually helps lots of people. What DTD are you validating to, and what is the error message?

amythepoet

12:12 am on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Tedster, wow, that is great

This is what I got:

This page is not Valid XHTML 1.0 Transitional!

1.

Line 55, column 3: document type does not allow element "h3" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag

<h3>Love Poetry, Birthday Poems, Anniversary Poems, Wedding Poems Created Just F

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

2.
Line 56, column 2: document type does not allow element "p" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag

<p>

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

)

3.
Line 57, column 3: document type does not allow element "h4" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag

<h4>Give a gift that will never be forgotten. Purchase a Personalized Poem from

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

)

[edited by: tedster at 12:28 am (utc) on July 31, 2004]
[edit reason] Too Much Information [/edit]

tedster

12:41 am on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I edited that validation output way down, Amy -- let's focus on what we've got here. Sometimes when you fix one real error, you see many other "errors" vanish, and the best approach is to fix the earliest errors first.

The errors I left are similar to each other, as were many other errors in your output. You seem to have an improper container element for those H tags and <p> tags - or you may have forgotten a closing tag earlier on the page. This XHTML, so you can't leave out any closing tags.

Take a look at your source code and see if those elements are contained by an inline element, or if you left an inline eemet open earlier on the page.

You may want to refer to:

Visual Formatting Model - W3C [w3.org]
Global Structure of an HTML Document [w3.org] (See 7.5.3 for block/inline elements)

amythepoet

12:50 am on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Tedster,

Thank you for your note. Now, I am confused about what you would like me to do.

Should I look at the source code for missing tags? I am just learning :)

Thank you

Amy

amythepoet

12:57 am on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Tedster, I just look a look at the code and I see that I have 3 h3 headings. This is not good, I know, but I do not know how to fix this.

Could you please help?

Amy

Birdman

1:21 am on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Amy,
Having three <h3></h3> tags will not hurt you at all. You shouldn't worry too much about it, really.

The errors, on the other hand, should be corrected.

Do this:
1) Count the lines in the source code(view source from browser, not actual server file) until you get to the first error. Copy and paste that line and include about three lines before and after it.
2) Post it here

Once you see what is wrong in the first error, you should be able to fix the rest yourself.

Birdman

amythepoet

1:41 am on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Dear Birdman,

Thank you and here are the lines:

The first error starts with the <h3> Love poetry, birthday poems, anniversary poems>

Thank you so much

Amy

td id="bgtd"><table width="98%" border="0" cellspacing="4" cellpadding="10">

<tr>
<td class="main" width="60%" align="left" valign="top">
<h2>Love Poems? We Do!</h2>
<p>
<h3>Love Poetry, Birthday Poems, Anniversary Poems, Wedding Poems Created Just For You.</h3>
<p>
<h4>Give a gift that will never be forgotten. Purchase a Personalized Poem from Poems To Go!</h4>

<p>Welcome to Poems To Go, a unique poetry service, where we create customized <a href="birthday4.html">friendship birthday poems</a>, <a href="weddings2.html">wedding toasts</a>, <a href="weddingvows.html">wedding vows</a>,
<a href="weddings3.html">wedding shower poems</a>, <a href="birthday1.html">birthday poems</a>,
<a href="anniversary.html">anniversary poems</a>, and poetry for <a href="specialoccasiontwo.html">all special occasions.</a></p>
<p>As the <a href="toasttocouple.html">Best Man</a>, or <a href="maidofhonor.html">Maid of Honor</a>, are you searching for just the right words to say to the bride and groom?
Finding the perfect words is not always the easiest of jobs.</p>

sonjay

2:20 am on Jul 31, 2004 (gmt 0)

10+ Year Member



Here's your problem:

<p>
<h3>Love Poetry

You have an open, empty, unclosed <p> tag before the <h3> tag.

Same thing on the next line:

<p>
<h4>Give a gift

Just remove those stray <p> tags.

You probably should scan the page for any more of those.

tedster

2:24 am on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Right - and more.

Not only is your <p> tag not closed, but it has no content - it's a "null" paragraph. I would guess that the <p> is only there to add some extra spacing -- but that's not what a paragraph is really about.

The extra spacing, if needed, should be added with a CSS style that adds the desired margin-top or padding-top to the <h3> element itself.

amythepoet

2:42 am on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Oh Ok, I will remove the <p> tags, thank you.

Yes, I wanted to add an extra line and that is why I put them there, but I w ill remove them

Thank you

Amy

amythepoet

2:50 am on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ok, I did as you said and that helped. Thank you!

Now, I still have more errors as I just ran the page through the validation checker again.

Could I send you the new errors again?

Amy

tedster

3:01 am on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sure, but let's take them one small bite at a time, OK ;)

amythepoet

3:26 am on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sure, thank you. I'm tired now,, so I will send this in and read the reply in the morning.

Thank you again,

Amy

Line 70, column 6: document type does not allow element "h3" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag

<h3>Ordering Your Personalized Poem is Quick and Easy</h3>

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

)

Here is line 70

<p>Ordering a personalized poem is quick and easy. All you have to do is:</p>

tedster

3:47 am on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Amy - something's off there - the validator and the source you pasted aren't the same. Try the validator again and make sure you take the line of mark-up from the exact same version of the HTML that you sent to the validator.

amythepoet

4:14 am on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Right, I see that too, let me try again

Here is the error;

Line 70, column 6: document type does not allow element "h3" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag

<h3>Ordering Your Personalized Poem is Quick and Easy</h3>

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

)

and here is my line:

<h3>Ordering Your Personalized Poem is Quick and Easy</h3>
<p>Ordering a personalized poem is quick and easy. All you have to do is:</p>

thanks and now good night

amy

tedster

7:01 am on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If that's the first error the validator report on the page, then something is off a line or two back, before the <h3> tag is opened. The error says: not allowed to appear in the context in which you've placed it, so we need to see what that context is.

I'd again suggest you look for an unclosed tag, as the hint says at the end of your error report.

amythepoet

10:40 am on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Tedster,

Good morning, I found the error and fixed that one, thank you.

Now, I have another error here:

Line 62, column 8: document type does not allow element "p" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag

<p>As the <a href="toasttocouple.html">Best Man</a>, or <a href="maidofhon

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

)

Here is my line:
<p>As the <a href="toasttocouple.html">Best Man</a>, or <a href="maidofhonor.html">Maid of Honor</a>, are you searching for just the right words to say to the bride and groom?
Finding the perfect words is not always the easiest of jobs.<br /><br />

I had hoped that my adin the <br /><br />, the line would be fixed, but I still receive the error.

Amy

TheDoctor

4:12 pm on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi Amy,

Once again, the validator is telling you that the 'document type does not allow element "p" here'. 'Here' means the context in which it finds the line.

There's nothing wrong with your line, so, once again, the error must be in a line above the one in question. Have a look on the three or four lines above line 62 for tags that are not closed. If you can't see a problem, post the relevant lines here again.

Incidentally, I'd get rid of the <br />s. There's nothing wrong with them, but you'd be better off using CSS to format your page. Don't worry about that at the moment. We'll get to it once we've got your HTML validated.

amythepoet

5:28 pm on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi again,

I can't seem to find the problem. Here are the three lines directly above the line in question.

<p>Welcome to Poems To Go, a unique poetry service, where we create customized <a href="birthday4.html">friendship birthday poems</a>, <a href="weddings2.html">wedding toasts</a>, <a href="weddingvows.html">wedding vows</a>,
<a href="weddings3.html">wedding shower poems</a>, <a href="birthday1.html">birthday poems</a>,
<a href="anniversary.html">anniversary poems</a>, and poetry for <a href="specialoccasiontwo.html">all special occasions.</a>

Thank you

Amy

tedster

6:28 pm on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You are validating to XHTML, so you must close every tag. There must be a </p> before you begin a new <p> element. Other wise you are saying "now put a paragraph inside this paragraph" and that's a kind of nonsense.

In HTML (no X) certain tags, including <p> have an optional end tag. If you don't close it explicitly and new one comes along, it is just "assumed" to be closed. But that looseness does not exist in XHTML.

amythepoet

7:07 pm on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi, things are a bit better now, thank you.

Now, I have this error:

Line 70, column 6: document type does not allow element "h3" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag

<h3>Ordering Your Personalized Poem is Quick and Easy</h3>

The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").

)

g1smd

7:12 pm on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yet again, you have have a heading tag that "cannot appear inside some other tag" here.

So, again, the error will be within the line or two above -- probably an unclosed paragraph again.

tedster

7:13 pm on Jul 31, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Looks like the same thing, Amy - some element is still open and therefore an H3 tag can't be placed until you close whatever it is that you opened earlier.

Roll up your sleeves, my friend, and pour through that mark-up making sure your tags are all closed properly.

This 47 message thread spans 2 pages: 47