Jump to content

error I cannot figure out


htmlnewbie23

Recommended Posts

There are 2 errors I keep getting when I validate a page containing a table that I just cannot seem to resolve. I've extracted the problem part of the html into a separate page and I still get the error.The problem source code (page at http://www.orthohelp.com/geneal/test.html ), problem areas shown in bold is:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title> test </title> <meta name="GENERATOR" content="Arachnophilia 5.3"> <meta name="FORMATTER" content="Arachnophilia 5.3"> </head> <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000"> <TABLE border=8><tr> <TD> <a href="link to book" title="Book title" TARGET="new"> <center><FONT face="Arial, Helvetica, sans serif" color=blue>Author's name <br> <b>Title of book </b><br> (Publisher, 2007) <hr width="50%"> <b><center><img src="im/test.gif" width=260 height=103 alt="Book Chapters and purchase Information - at (publisher)" border="0"></center></b> <font color=red> Book Award<br> for 2007</font></font></center></a> </TD> </table> </body></html>The errors I get are: "document type does not allow element "CENTER" here; missing one of "APPLET", "OBJECT", "MAP", "IFRAME", "BUTTON" start-tag." But if I remove "center" everything aligns to the left - which I do not want.2. same error for using hr within that table, but how else can I insert a horizontal line here?Any help would be greatly appreciated.

Link to comment
Share on other sites

Althoough, I should, I dont actually validate any of my pages, because it would take me forever to do so and so I may not be correct in what I say next:My understanding is the the <center> tag is probably depreciated, but I can not be sure, if you can find a substitute for this tag then your code should be one step closer to being valid.

Link to comment
Share on other sites

Althoough, I should, I dont actually validate any of my pages, because it would take me forever to do so and so I may not be correct in what I say next:My understanding is the the <center> tag is probably depreciated, but I can not be sure, if you can find a substitute for this tag then your code should be one step closer to being valid.
The error message does not say it is deprecated (as it does in other situations). It actually says "not allowed".I used to not validate my pages too, and they all work fine, but I am now trying to "do the right thing". Otherwise, whenever I have a html display problem and ask for help, the first thing the experts reply is "well, if you validate it you will see that your page is full of errors" and I can get no further help. Sort of catch-22.
Link to comment
Share on other sites

People don't want to troubleshoot a page that shows validation errors. It's a waste of time to try and determine what the source of a problem is if the page has several errors already on it, so it makes sense to fix those errors first and then see if the problem is still there, and then find a valid solution.It doesn't like the center tag there I think because it is inside an anchor tag. This, for example, doesn't make a lot of sense:<a><hr></a>That's probably why it is complaining about the hr tag. You can eliminate the center tag altogether by setting text alignment on the container (the td):

<TABLE border=8><tr> <TD style="text-align: center;"></TD></tr></table>

You also left off the </tr> tag.For the other stuff, close and reopen the <a> tag so that it doesn't include anything that shouldn't be in there.

<TABLE border=8><tr> <TD style="text-align: center; font-family: Arial, Helvetica, sans-serif; color: blue;"><a href="link to book" title="Book title" TARGET="new">Author's name <br><b>Title of book </b><br>(Publisher, 2007)</a><hr width="50%"><a href="link to book" title="Book title" TARGET="new"><b><img src="im/test.gif" width=260 height=103 alt="Book Chapters and purchase Information - at (publisher)" border="0"></b><span style="color: red;"> Book Award<br>for 2007</span></a></TD></tr></table>

Also, font tags have been deprecated for a while (not in HTML, but in XHTML), it's best to not use any font tags. Use CSS instead. I put some of the CSS in the TD tag, and replaced a font tag with a span.

Link to comment
Share on other sites

People don't want to troubleshoot a page that shows validation errors. It's a waste of time to try and determine what the source of a problem is if the page has several errors already on it, so it makes sense to fix those errors first and then see if the problem is still there, and then find a valid solution.It doesn't like the center tag there I think because it is inside an anchor tag. This, for example, doesn't make a lot of sense:<a><hr></a>That's probably why it is complaining about the hr tag. You can eliminate the center tag altogether by setting text alignment on the container (the td):
<TABLE border=8><tr> <TD style="text-align: center;"></TD></tr></table>

You also left off the </tr> tag.For the other stuff, close and reopen the <a> tag so that it doesn't include anything that shouldn't be in there.

<TABLE border=8><tr> <TD style="text-align: center; font-family: Arial, Helvetica, sans-serif; color: blue;"><a href="link to book" title="Book title" TARGET="new">Author's name <br><b>Title of book </b><br>(Publisher, 2007)</a><hr width="50%"><a href="link to book" title="Book title" TARGET="new"><b><img src="im/test.gif" width=260 height=103 alt="Book Chapters and purchase Information - at (publisher)" border="0"></b><span style="color: red;"> Book Award<br>for 2007</span></a></TD></tr></table>

Also, font tags have been deprecated for a while (not in HTML, but in XHTML), it's best to not use any font tags. Use CSS instead. I put some of the CSS in the TD tag, and replaced a font tag with a span.

Thank you so much. That is all very helpful and I really appreciate your time and help. At my level, I promise you it is not because of lack of trying that I just resorted to asking the question. It's just that trying this and then that makes the beginner feel like he is knocking his head against a wall and getting nowhere.
That's probably why it is complaining about the hr tag.
I realized that, but what alternative is there if one needs to put a "line" (hr) in that link for appearance sake? See http://www.orthohelp.com/geneal/test.html .Thank you again VERY much.
Link to comment
Share on other sites

I realized that, but what alternative is there if one needs to put a "line" (hr) in that link for appearance sake? See http://www.orthohelp.com/geneal/test.html .
I guess you just can't do it, a horizontal line apparently is not a linkable element. Just end the first link before the line and create a second link after the line. Both above and below the line will be clickable, but the line itself will not.
Link to comment
Share on other sites

If you want a clickable line, then your best bet is to take a print screen of the <hr> tag, then open it in paint or some other image editing program, then crop just a small bit of it out. Save this image, upload it and link to it within your link code, for example:

<a href="myfirstpage.html"><img border="0" width="??" src="mypic.gif"></a>

Then the image will be stretched to the appropiate length, and will look like a <hr> and be a link!You may like to make the width a percentage, then it will always display correctly on anyones PC.This may not be the best way of achieving what you want, but it should certainly work! :)

Link to comment
Share on other sites

If you want a clickable line, then your best bet is to take a print screen of the <hr> tag, then open it in paint or some other image editing program, then crop just a small bit of it out. Save this image, upload it and link to it within your link code, for example:<snip>
Thank you. The line itself really did not really need to be clickable. Being new at html, I just was not yet able to think of all the alternative possibilities and work arounds. This thread has taught me to see things in a different way, especially about putting attributes like <center> in the container tag instead of the link tag, etc. (I may not be using the correct terms). Thanks everyone. You've all been very kind and generous with your time to help a novice.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...