View Full Version : @Those good with W3 HTML coding standards...

10-05-2004, 01:00 AM
Ok, this is driving me insane. I'm trying to validate my page and have reduced it to 3 errors. All 3 pertain to my DIV tags and my attempt to center 3 certain images.
Now, if those are evidently invalid, illegal, deprecated, or whatever the hell the W3 calls them, what IS the standards compliant way to center something? If it matters, these items are inside a TD, but that shouldn't.

10-05-2004, 01:36 AM
I'd guess using CSS :p

10-05-2004, 01:43 AM
Thanks for the ummm... help? That's just a little vague...

EDIT: Gah, and I can't even post the error message they give me because the html screws up this topic page.

Dr Unne
10-05-2004, 02:16 AM
Post the HTML.

10-05-2004, 02:20 AM

That's the page with the validation results, the source is listed below it.

Dr Unne
10-05-2004, 02:35 AM
For one thing, all tags must be closed. That includes img and br tags. Use

<img src="blah.png />


<br />

10-05-2004, 02:46 AM
Bah, I thought that was only in strict things (XHTML for example). If that's really the case I've got a lot of work to do...

EDIT: http://validator.w3.org/check?uri=http%3A%2F%2Fs95327316.onlinehome.us%2F&charset=%28detect+automatically%29&doctype=%28detect+automatically%29&ss=1

Ok that didn't take as long as I thought... every BR tag ends in " /" now and every IMG tag as well.

Problem still isn't solved but I suppose this is a step towards the right direction anyways.

10-05-2004, 10:35 AM
Try changing

div style="text-align: center;"

To this

div align="center"

Dr Unne
10-05-2004, 09:08 PM
Tags can't be capital letters. Change TITLE to title for example.

Anyways, that error tells you exactly what's wrong.

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>").

Looking at your code, you have a &lt;b> on line 40 and it's closed on line 135. You can't have a div inside a b. b is inline and div is block. You're trying to boldify a div, which is undefined behavior. Remove the b and the closing b and it validates. You should put the b tags around all the individual bits of text you want boldified.

It only validates as HTML though. You should really try to get it to validate as XHTML. Actually I was wrong, I don't think you even need to close all your tags in HTML, like I said above, or make all your tags lowercase either; I was assuming you were going for XHTML. XHTML is the GOOD standard. It's not hard to get it to that level either. Replace your b's with strong's and your i's with em's, and stuff like that.

10-05-2004, 09:24 PM
Why bother having all these rules, like no capitals, it it still works in both browsers fine? What difference does it make?

Dr Unne
10-05-2004, 09:40 PM
The purpose of standards is to make sure that when I make a web page over here, no matter where you are, it'll look the same. That's why there are so many rules; honestly, the more rules the better, so long as the rules don't take away from the power of the language. The rules probably make it easier to standardize web browsers. Defining XHTML strictly doesn't leave room for IE to do one thing and Mozilla to do another, in terms of rendering pages.

Some rules are less important than others though. XHTML is HTML that is also XML, so that's WHERE the rules come from. XML happens to say that tags should be all lowercase, and the values should be quoted, for example. As for WHY the rules exist, that's debateable I guess. The quote rule is a good and necessary rule; what if your value has a space in it? Quotes are necessary in that case. The lowercase thing honestly could've gone either way in my opinion. They could've made it all uppercase, or a combination of either. But they did have to pick SOMETHING as the standard.

Programming languages in general tend to have all lowercase keywords, maybe that's why they picked it. Beats me. All lowercase tags also sets them apart from the text and makes it easier to read. And if you allowed a mix, you are required to define more rules: should an HTML tag be the same as an html tag? What about Html, or HtMl? If I open an HTML tag, can I close it with an html tag, or do I need to close it with HTML too? XML is geared towards being exact. The whole purpose of XML is data-exchange, and with data that's more complex than HTML (and a lot of data IS far more complex), the little details can matter.

10-06-2004, 04:29 AM
Thank you Unne, you are a GOD, and yes I've been reading up on it and plan to eventually achieve XHTML Strict, but I've gotta step up slowly from HTML Transitional right now.

Thank you once again.

10-07-2004, 02:42 AM
Well my main page w/ the default "News" and "Menu" includes is verified XHTML, now comes the hard part... doing the entire content of the site :eek: :eek: This'll be slow-chugging I can guaruntee.