Forum Moderators: open

Message Too Old, No Replies

help with validation error

         

KathyJones

2:21 am on Apr 18, 2003 (gmt 0)

10+ Year Member



How do I fix this, what did I do wrong?
This is the error I got on the validation page:
"end tag for element "COL" which is not open (explain...).
<col width="80"></col>"

And Following is my code:

<table border="1">
<colgroup span="3">
<col width="15"></col>
<col width="50"></col>
<col width="30"></col>
<col width="20"></col>
</colgroup>
<tr>
<td>15</td>
<td>50</td>
<td>30</td>
<td>20</td>
</tr>
</table>

dreaming of nascar

2:34 am on Apr 18, 2003 (gmt 0)

10+ Year Member



I believe that </COL> is invalid. There is no closing tags for <COL>. Remove the </COL> tags and it should work.

D O N

grahamstewart

2:38 am on Apr 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The error is saying that you have more closing column tags </col> than you have opening ones <col>

Since the error mentions a column with its width set to 80, and none of the columns in your pasted code have that width, I would suggest the problem is in a different table.

Also be aware that you have <colgroup span="3"> when there are 4 columns.

grahamstewart

2:40 am on Apr 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I believe that </COL> is invalid

Doh! Oh yeah, that too.....

KathyJones

2:54 am on Apr 18, 2003 (gmt 0)

10+ Year Member



Got you, the problem was that <col> doesn't have a closing like </col>. But why is that? Doesn't everything in HTML have a matching close tag like that? I'm confused becuase the example on w3http://www.w3schools.com/tags/tag_col.asp) has it. But when I put it in my code, it didn't validate. Same problem with <input>, supposely <input> doesn't have a closing tag </input> either, but the example on w3schools has it too. Sorry if this question seem to be very basic, I'm new to HTML, trying to learn by myself....

grahamstewart

2:59 am on Apr 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hmm.. sounds like w3 schools has some mistakes in it.
If in doubt always take a look at the spec, for html4.01 this is [w3.org...]

Its written for nerds by nerds, so some of the language can be a little confusing at times, but it should tell you anything you need to know.

DrDoc

3:05 am on Apr 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In HTML, no, not all elements have closing tags. In XHTML, yes, they all do.

However, to avoid problems when writing XHTML: for elements like <br> and <input>, don't include </br? or </input> afterwards (even though this is correct, XML strictly speaking). Do this instead:

<br /> and <input />

This is a "shorthand closing tag" and is the prefered way of doing it. However, in HTML 4 tags like BR, HR, INPUT shouldn't have any form of closing tags at all.

grahamstewart

3:05 am on Apr 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Doesn't everything in HTML have a matching close tag like that?

Not always.

Basically if an element can contain something (like text) then it will have an opening and closing tag.

e.g. elements like <div>, <td>, <span>, <p>, <form> etc require closing tags.

but if the element can't contain anything then it wont.

e.g. elements like <img>, <col>, <br>, <input> don't require closing tags

Hope that helps.

ShawnR

3:36 am on Apr 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Just to be pedantic, and restate what has probably already become obvious: For some tags the closing tag is required, for some it is optional (such as <li>, and for some it is illegal to have a closing tag.

Kathy, you are to be commended for making such a valiant effort to be standards compliant, given that you are probably fairly new to web development. While I respect w3schools for some things, you are probably doing things the hard way if you are using their online tutorials to get started. Perhaps have a look at [webmasterworld.com...] instead.

Shawn

DrDoc

3:40 am on Apr 18, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Kathy, you are to be commended for making such a valiant effort to be standards compliant

That is very true! And, please don't stop! :)

g1smd

6:39 pm on Apr 18, 2003 (gmt 0)

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



Please keep checking your code, and fixing the errors. I hate visiting broken sites, and don't return. I'm sure some people lose a lot of business through poorly coded sites.

DLadybug

5:30 am on Apr 21, 2003 (gmt 0)

10+ Year Member



I'm having fits over validation because I just can't understand what the complaints are.

I inserted the code to embed a Google search on my pages. I like it. Validator loathes it. I now have 63 errors, 61 of which are in the google lines. The other two I think I can figure out, but can anyone see what the problem is with this validating to xhtml 1.1 strict? w/ css


<div id="goog">
<form method=get action=http://www.google.com/custom target=_blank>
<table bgcolor="#FFFFCC" cellspacing="0" border="0">
<tr valign=top>
<td>
<a href="http://www.google.com/search">
<img src="http://www.google.com/logos/Logo_40wht.gif" border="0" alt="Google" align="middle"></a>
</td>
<tr valign=top>
<td>
<input type=text name=q size=35 maxlength=255 value="">
<input type=submit name=sa value="Google Search">
<input type=hidden name=cof value="LW:396;L:http://myurl.com/mylogo.jpg;LH:160;BGC:#ffffcc;AH:center;S:http://myurl.com;AWFID:4d4626b792a88e3e;">
<font face=arial,sans-serif size=-1>
<input type=hidden name=domains value="myurl.info;myurl.com"><br />
<input type=radio name=sitesearch value="myurl.info"> Search myurl.info
<input type=radio name=sitesearch value="myurl.com"> Search myurl.com
</td></tr>
<tr><td>
<input type=radio name=sitesearch value="" checked> Search WWW
</font></td></tr></table>
</form>
</div>

I think when I copied this code, it had all caps, which I changed to lower case, and I half remember changing the order of two table cells, but other than that, this is the code google created based on my selections for display. any ideas?

Dian :)

pageoneresults

5:38 am on Apr 21, 2003 (gmt 0)

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



I've not had to validate yet to the xhtml standard, but, I see a lot of unquoted attributes which are probably the issue. If you have that many errors, I see that many unquoted attributes in the above code.

If I'm not mistaken, I believe Google strips the quotes from its attributes to save on bandwidth.

Example of quoted attributes. This code here...

<input type=text name=q size=35 maxlength=255 value="">
<input type=submit name=sa value="Google Search">

...should look like this...

<input type="text" name="q" size="35" maxlength="255" value="">
<input type="submit" name="sa" value="Google Search">

tedster

6:12 am on Apr 21, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



And all the input tags need to be closed:

<input type="text" name="q" size="35" maxlength="255" value="" />

DLadybug

7:57 am on Apr 21, 2003 (gmt 0)

10+ Year Member



Bless you both. Yes, I knew it didn't look like my other stuff, but was afraid I might hurt the google thing. It seems silly, but yeah, I'm chicken to mess with anything I didn't write. I was afraid maybe the search functions were supposed to be written that way but I guess it IS just supposed to be html, the search function isn't really "in there".

I'll learn to trust my hunches more, but in the mean time, thanks for the back-up! I'll go make it right.

~Dian

g1smd

6:46 pm on Apr 21, 2003 (gmt 0)

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



>> I'll go make it right. <<

Nice to see people taking the time and effort to do so!

DLadybug

12:32 am on Apr 22, 2003 (gmt 0)

10+ Year Member



Ok, this is NOT a new feeling for most of you, but it's made me so excited I could die happy right now...

This Page Is Valid -//W3C//DTD XHTML1.1//EN!

Thanks to this forum..because I sure couldn't understand the comments at the validator!

(using Strict, AND no tables for layout, Thanks for CSS assistance from the people at the CSS forum here too!)

~Dian
Just buggin'