Log in

View Full Version : Trying to validate my HTML



ModernRevolutions
03-03-2009, 12:39 PM
Okay, I am trying t validate my HTML with this (http://validator.w3.org/check?uri=http%3A%2F%2Fwww.modernrevolutions.vivid-avenue.net%2F&charset=(detect+automatically)&doctype=Inline&outline=1&group=0&user-agent=W3C_Validator%2F1.606). But I can't understand what to do. Like the CSS Validator told you what was wrong and gave you the right way to do it at the bottom but this one isn't doing that and I have no idea what to do. One of the major things is the Doctype. First of all I have no idea what a Doctype or how to add one. I clicked the link to the "how to add a doctype" and I literally copy and pasted the code thing and then revalidated and it gave me 2 new errors! Can someone help me with this and explain it to me in plain English?

Here (http://www.modernrevolutions.vivid-avenue.net) is my site.

traq
03-03-2009, 03:38 PM
Until you learn more about validation, I would try using the HTML 4.01 Transitional doctype instead of the Strict. But yes, you will have more errors show up to start with, because the doctype changes the way your code is interpreted: it tells the browser specifically how to handle it, instead of letting it guess.

Add this to the very top of your page (removing all other doctypes or doctype parts):

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
You will also need a valid content-type declaration, such as

<meta http-equiv="content-type" content="text/html; charset=utf-8">
in your <head> section (I don't know exactly what character set you're using, but utf-8 is a pretty safe bet).

Then, revalidate and see what comes up. My advice is to try solving only one error at a time, so you can keep track of what you're doing easier (and don't waste too much time fixing things the wrong way!).

Good luck!

Snookerman
03-03-2009, 04:16 PM
Actually, I would recommend that use use the Strict doctype from the beginning so you will learn it the right way from the start.

Twey
03-03-2009, 10:34 PM
Yes: 'I don't understand what I'm doing, so I'm going to tailor my site to an antiquated DOCTYPE based on the previous version of HTML' is not good thinking.

Your HTML is really very mangled. I would suggest you start with a good tutorial (http://www.howtocreate.co.uk/tutorials/html/basics), but just to get you kick-started, the outline of your document should look like this (<!-- ... --> denotes a comment; these blocks are here for your information only, and you can safely remove them):


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!-- This is the DOCTYPE, the thing that tells the parser
what sort of markup we'll be using in this page.
This is the *only* thing that should be outside the
<html> element. -->

<html>
<head>
<!-- This is the <head> of your document. Assorted
data to do with the document that isn't part of the
actual displayed content will go here. -->

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- This specifies that your page should be interpreted
as UTF-8, a Unicode encoding. At the moment your
page doesn't actually validate as UTF-8, but you
should probably convert it (there will be an option
in your editor). -->

<title>The title of your Web page</title>
<!-- This is the title of your Web page. It will appear
in the title bar or on the tab in most current
browsers when accessing your page. -->

</head>

<body>
<!-- The content of your page goes here, but don't put
text directly here: it needs to be wrapped in block
elements like <p> or <div>. How you organise
your content depends on what it is.
Generally you will have a few <div>s that divide
the page up into things like title, navigation,
content, and footer, and then <p>s within the content
section to denote paragraphs; for the navigation,
one or more <ul>s is usually the best course. -->
</body>
</html>

ModernRevolutions
03-03-2009, 10:51 PM
Okay, so I added the main tages, (head, html, doctype, and body) is there anything MAJORLY wrong with my HTML what is a MUST fix? If so what, and how would I go about fixing it? Thanks to all who have posted :)

Twey
03-03-2009, 11:18 PM
Yes: every one of these forty-four errors (http://validator.w3.org/check?uri=http%3A%2F%2Fwww.modernrevolutions.vivid-avenue.net%2Fdoctype=HTML+4.01+Strict). It's a total mess. It doesn't even begin to make sense. It's the HTML equivalent of the English sentence 'green wub hummed flinger Johnny elephant'. I would suggest going through the tutorial and then doing a total rewrite.

molendijk
03-04-2009, 12:33 AM
You can use http://validator.aborla.net/ to help you correct errors.
===
Arie.

molendijk
03-04-2009, 12:55 AM
Yes: 'I don't understand what I'm doing, so I'm going to tailor my site to an antiquated DOCTYPE based on the previous version of HTML' is not good thinking.
I think the question about which doctype is 'allowed' is less important than knowing exactly what doctypes do, and why you want to use one doctype rather than another (of the basic three). If you cannot drive a Mercedez, then use a bike. The important thing is to be able to use the means of transport enabling you to get where you want to be. (But, eventually, the bike may prove too slow, or may prove to lack certain fundamental things). Anyhow, validation shouldn't be a goal in itself, but merely a means to be sure that your site will show correctly on any browser. If you could find a way to be sure about that without the validation-requirement, it would be fine.
===
Arie.

Twey
03-04-2009, 01:41 AM
On any browser, present or future — practically speaking, that means it has to be standards-compliant to a modern level. That's the reason standards exist.

Transitional DTDs are not modernly compliant. They are based on the old HTML3 DTD, and were never intended to be used as anything other than a stop-gap measure to ease the transition from HTML3 to HTML4 or XHTML1 (hence the name). That was over a decade ago now, meaning that the Transitional DTDs are effectively more than ten years out of date. Nobody writes HTML3 any more, so why do people still use HTML4?

Snookerman
03-04-2009, 07:06 AM
If you cannot drive a Mercedez, then use a bike.
More like "if you don't want to learn how to drive a car, use a 19th century steam engine powered automobile and watch all modern vehicles overtake you and when flying cars became popular, start learning how to drive a car" :D

* The flying cars in this confusing metaphor would be HTML5

molendijk
03-04-2009, 10:55 AM
More like "if you don't want to learn how to drive a car, use a 19th century steam engine powered automobile and watch all modern vehicles overtake you and when flying cars became popular, start learning how to drive a car"
Ha! Nice comparison.
But as long as IE-passengers don't fit into my modern vehicle, I have to have some means to transport them. I cannot simply throw them out of my car.
===
Arie.

Snookerman
03-04-2009, 11:07 AM
Ha! Nice comparison.
But as long as IE-passengers don't fit into my modern vehicle, I have to have some means to transport them. I cannot simply throw them out of my car.
Emm.. what? Are you implying that IE doesn't support strict doctypes??

molendijk
03-04-2009, 11:57 AM
Emm.. what? Are you implying that IE doesn't support strict doctypes??
I am implying that Internet Explorer doesn’t support, for instance, using object elements the way they’re supposed to (for including content from another URL, images etc.). So IE forces us to use iframes, which aren’t allowed in any strict doctype.
===
Arie.

Twey
03-04-2009, 11:00 PM
Yes, but they can be squeezed in with things like the Flash Satay technique, and the occasional conditional comment.

molendijk
03-04-2009, 11:15 PM
The Satay technique is for movies and the like.
The conditional comment is, in fact, a hack.
What if I don't want to insert movies, but just foreign text (complete with its css and js), without using hacks? I have to ride my bike.
===
Arie.

Twey
03-05-2009, 12:45 AM
Conditional comments are not a hack. A hack in Web terms means using one bug to fix another — for example taking advantage of a CSS parsing bug to provide styles to IE only, and thereby correct a positioning bug.

Conditional comments are a deliberate feature, and while they should of course still be avoided if possible, since providing browser-specific content is quite ugly, they're much better than a hack (since we're fairly sure they won't be suddenly fixed in a future version, and they won't accidentally apply to more browsers than we expected), and much, much better than using a ten-year-outdated DTD (since you're still serving modern, standards-compliant code to those browsers that can handle it).

traq
03-05-2009, 01:24 AM
wow... quite a debate I sparked.

I didn't mean to say that anyone should settle for using an outdated doctype, only that it might be an easier place to start validating from than strict. Anything that is correct in HTML Strict will still be correct in HTML Transitional, right? Once he gets the "loose" errors fixed, he can start on the "strict" errors.

I'm not claiming that this is the best way to do it, either, I just made the suggestion from personal experience: when I first learned that doctypes existed (and yes, they'd already been around for quite some time), I was completely overwhelmed and confused by the hundreds of thousands of errors that the "strict" doctype produced. "loose" let me figure things out and get stuff that at least *worked*, an important first step, I think.

Twey
03-05-2009, 04:01 AM
The way to tackle that should have been to start with a blank Strict page, and slowly add in elements, fixing the errors as you go. You can of course just work down from the top error — considering that most of the lower errors were probably caused by earlier errors — but it's tempting to use quick fixes to tackle each error, whereas better practice might dictate a complete rewrite.

ModernRevolutions
03-13-2009, 11:26 PM
Okay, I have been working on Validating it (and actually fixing errors!) ahahah Well anyway, I read what you guys wrote and frankly I don't understand a lick of it. However, I am starting to actually figure this Validator thing out. However, one of the reoccurring "problems" with it is this:

…title="Wanna be here?" class="topaff"></a>

How would I fix something like that? Here (http://validator.w3.org/check?uri=http%3A%2F%2Fwww.modernrevolutions.vivid-avenue.net%2Findex.php%3Fid%3D30&charset=(detect+automatically)&doctype=HTML+4.01+Strict&group=0&verbose=1&user-agent=W3C_Validator%2F1.606) is the link to my validation page thing.

bluewalrus
03-14-2009, 12:09 AM
required attribute "ALT" not specified.

…" title="vivid-avenue" class="topaff"></a>


put an alt in the image tag ...
i assume...
" title="vivid-avenue" class="topaff" alt="something"></a>

ModernRevolutions
03-14-2009, 02:52 PM
Oh, I didn't know all images needed that :/