PDA

View Full Version : w3.org tells me that tags are not closed, but all seems ok to me



needsomehelp
Mar 11th, 2010, 03:10 PM
I am unable to figure out why my code will not validate on w3.org, it shows the following error which i think is the main one....

----
# Error Line 5, Column 73: end tag for "meta" omitted, but OMITTAG NO was specified

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

You may have neglected to close an element, or perhaps you meant to "self-close" an element, that is, ending it with "/>" instead of ">".
-----

any the othersare al similar saying that tags were not closed properly.

all seems ok or is there something that i have missed.

can anyone advise.



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>this</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="style.css" />

</head>
<body>
<div id="mainhomepage-container">
<div id="container">
<div id="logo"></div><!-- left -->
<div>
<b style="font-weight: normal; font-size: 2em; line-height: 1em;">Welcome to </b>
<b style="font-weight: normal; font-size: 5em; line-height: 1em;">this</b><br>
<div style="font-size: 1.05em; font-weight: bold; line-height: .5em; color: #99FFFF;">&nbsp;this</div><br>
<div style="font-size: .7em; line-height: 2.9em;">that</div>
</div><!-- right -->
<div class="clear"></div>
</div><!-- container -->

<div class="left"></div>
<div id="mainhomepage-maincontent">
<div id="menubar-container">
<div id="left">&nbsp;&nbsp;&nbsp;Welcome user</div><!-- left -->
<div>
<div id="menubar">
<a href="" class="nd"><em>WAP</em></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="" class="nd"><em>chat</em></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="" class="nd"><em>logout</em></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="" class="nd"><em>change password</em></a>
</div>
</div><!-- right -->
<div class="clear"></div>
</div><!-- container -->
<h2>this</h2>

<p id="p_status">Status: Normal</p>
Currently<div>
<img src="resize_d.gif" width="21" height="9" onclick="Div('div_chat','h',20);">&nbsp;
<img src="resize_u.gif" width="21" height="9" onclick="Div('div_chat','h',-20);">&nbsp;&nbsp;
<img src="resize_r.gif" width="21" height="9" onclick="Div('div_chat','w',20);">&nbsp;
<img src="resize_l.gif" width="21" height="9" onclick="Div('div_chat','w',-20);">
</div>
<div id="chat-container">
<!-- left -->
<div>
<div id="div_chat" style="height: 300px; width: 500px; overflow: auto; background-color: #CCCCCC; border: 1px solid #555555;"></div>
</div><!-- right -->
<div class="clear"></div>
</div><!-- container -->
</div>

<br><br><div class="center"><b id="footertext1">'this' <b id="footertext2">&copy; &amp;</font> by </font></div>
</div>

</body>
</html>

drhowarddrfine
Mar 11th, 2010, 03:15 PM
In XHTML/XML, tags are closed with either a closing tag, </tag>, or self-closing <tag />. So add the closing slash.

needsomehelp
Mar 11th, 2010, 03:57 PM
In XHTML/XML, tags are closed with either a closing tag, </tag>, or self-closing <tag />. So add the closing slash.

i added in the /> to all the tags that w3.org complained about and now i get more errors still saying they are not closed
and that i need to add the end tag to every other tag i.e.

<input>

i am wondering if i have the correct header or if i need to use something else ?

fyndor
Mar 11th, 2010, 04:50 PM
I am not expert (here to ask questions as well), but in my experience that is what you need to do. You are better off sticking with XHTML (I personally use the strict version) and just doing it right like it asks. From what i see you need to do:

<meta />
<br />
<img />

As the previous poster said, in HTML its fine to have lone tags that have not close as long as they are types that can't wrap anything inside them. But in XML and thus XHTML all opening tags need a closing tag. The places where you will notice this are those tags that are "singles" in which case you just but a "/>" at the end of it instead of ">" and everyone's happy.

and...



<b id="footertext1">'this' <b id="footertext2">&copy; &amp;</font> by </font>


Whats going on there? <b> is bold right? I don't use <b>, but <strong> instead because people wiser than me told me to. Not exactly sure why. But anyway I assume this has to be a mistake. It looks like you either you intended 2 sets of <b> tags or 2 sets of <font> tags.

Excavator
Mar 11th, 2010, 05:14 PM
Good morning needsomehelp,
XHTML elements (http://www.w3schools.com/XHTML/xhtml_html.asp) needs closed with a />. Run this through the validator -
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>this</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="style.css" />

</head>
<body>
<div id="mainhomepage-container">
<div id="container">
<div id="logo"></div><!-- left -->
<div>
<b style="font-weight: normal; font-size: 2em; line-height: 1em;">Welcome to </b>
<b style="font-weight: normal; font-size: 5em; line-height: 1em;">this</b><br />
<div style="font-size: 1.05em; font-weight: bold; line-height: .5em; color: #99FFFF;">&nbsp;this</div><br />
<div style="font-size: .7em; line-height: 2.9em;">that</div>
</div><!-- right -->
<div class="clear"></div>
</div><!-- container -->

<div class="left"></div>
<div id="mainhomepage-maincontent">
<div id="menubar-container">
<div id="left">&nbsp;&nbsp;&nbsp;Welcome user</div><!-- left -->
<div>
<div id="menubar">
<a href="" class="nd"><em>WAP</em></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="" class="nd"><em>chat</em></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="" class="nd"><em>logout</em></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<a href="" class="nd"><em>change password</em></a>
</div>
</div><!-- right -->
<div class="clear"></div>
</div><!-- container -->
<h2>this</h2>

<p id="p_status">Status: Normal</p>
Currently<div>
<img src="resize_d.gif" alt="description goes here" width="21" height="9" onclick="Div('div_chat','h',20);" />&nbsp;
<img src="resize_u.gif" alt="description goes here" width="21" height="9" onclick="Div('div_chat','h',-20);" />&nbsp;&nbsp;
<img src="resize_r.gif" alt="description goes here" width="21" height="9" onclick="Div('div_chat','w',20);" />&nbsp;
<img src="resize_l.gif" alt="description goes here" width="21" height="9" onclick="Div('div_chat','w',-20);" />
</div>
<div id="chat-container">
<!-- left -->
<div>
<div id="div_chat" style="height: 300px; width: 500px; overflow: auto; background-color: #CCCCCC; border: 1px solid #555555;"></div>
</div><!-- right -->
<div class="clear"></div>
</div><!-- container -->
</div>
<!--
<br><br><div class="center"><b id="footertext1">'this' <b id="footertext2">&copy; &amp;</font> by </font></div>
this line is really messed up-->
</div>
</body>
</html>

needsomehelp
Mar 11th, 2010, 05:29 PM
i just created a new doc in dreamweaver and copied over the top line that it puts in most pages top line and the page now validates ok.

i was going to say i have coded without the need for closing tags for ages and thought wow over 100 errors !!

all seems ok for now.

thanks anyway



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


fyndor
you are correct it should have been <strong> this was a typo on my part, i have corrected this in my live site now. thank you for pointing this out to me.

i have heard this too it seems that <b> is not used nowadays as <strong> has taken over.

fyndor
Mar 11th, 2010, 05:35 PM
But XHTML is the future!!! :)

Oh well. So if I am understanding you, if you create something in Dreamweaver and then try to validate the page that it generated it doesn't validate? How does Dreamweaver get away with this flaw in their design? I guess all WYSIWYG HTML editors could have this problem for all I know, I hand code all my webpages. There is no way I could keep my pages consistent across my site if I used an HTML editor.

Anyway glad you found your fix.

_Aerospace_Eng_
Mar 11th, 2010, 05:47 PM
i just created a new doc in dreamweaver and copied over the top line that it puts in most pages top line and the page now validates ok.

i was going to say i have coded without the need for closing tags for ages and thought wow over 100 errors !!

all seems ok for now.

thanks anyway



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


Thats called a doctype and you've chosen the wrong one. The one you are using is incomplete and it will cause issues in other browsers. I suggest you use a full complete doctype. HTML Strict or XHTML Strict are the way to go. Don't be lazy and leave the errors there.