w3c validation?

Can someone explain what w3c validation is?

I was told to put this code at the top of my html documents in my website.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN" "http://www.w3.org/TR/REC-
html40/loose.dtd">

Then I was told to go to this website and enter the URL of my website. It said there was 29 errors even though I made sure there were no errors in the entire website.

validator.w3.org

The errors sounded so rediculous. I didn’t know that you can’t use the <br /> tag. It said there is no such thing as the “bgcolor” attribute of the <body> tag. It said there is no “name” attribute of the <a> tag. These sound so rediculous.

Can someone help me out?

W3C validation checks for compliance with the accepted standards of HTML code.

The W3C standard is the basic level of support you can expect from all web browsers. Often, certain browsers will support much more than what’s expected by the W3C standards, but what is supported and how it’s supported may change from one browser to the next.

Some people are diehard compliance freaks, some are not.

Oh man. It’s just so overwhelming whenever someone starts to learn about writing actual HTML as per W3C standards. Up until now, you’ve probably been writing code for so-called ‘version three’ browsers, also known as ‘tag soup.’ Don’t worry, there are still a lot that do, because knowledge of how browsers interpret info isn’t common. Ever find it strange that some tags exist in some browsers but not others? Not if you write for standardized HTML (which every modern browser and HTML editor now uses predominantly). Not only does the W3C (among many other things) standardize what HTML tags a browser should and shouldn’t read, but it also states exactly how browsers should read them, and tells authors how to write for them. I suggest you make it a habit of writing HTML 4-compliant code, or else things are so much more difficult and so much more ludicrous. It’ll get tougher and tougher to write code as you have presumably been doing in the long run, as all user agents are starting to run on standards.

The W3C is where HTML, CSS, RSS, XML, etc. is standardized and developed under the watchful eyes of all interested companies (e.g. Microsoft, Apple, Opera). The DTD (Document Type Definition) you were told to put in tells the browser what standard of HTML you are following. It drastically changes how the web brower will interpret your data. If your Doctype were to say “HTML 3.0,” the set of legal tags the browser reads is different; in general, the lower the number the closer it is to ‘tag soup,’ which is what webdesigners call the code written in the early 90’s when Netscape and Microsoft made up their own stuff and the W3C barely kept the Web together (begging Netscape to support <blink> or Microsoft to support <embed> and on and on). If you don’t have a DTD, a browser would read your code in its ‘quirks mode’ which is designed to use its error-handling to interpret potentially bad code and still output something good. If you have a new DTD (The final release of HTML is version 4.01.), the browser will be more strict in its interpretation (using ‘standards mode’) of your code and will do things closer to what you’d expect.

Now all that being said, there are a lot of people who are obsessive over the W3C without knowing the purpose of standards. Also, a lot of people just don’t think they are necessary (which may be true to a limited extent in this day in age). Think of it this way though: if you choose to write standard HTML, make sure it is semantically correct. Many proponents of standards run their code through a validator and think that’s it. It isn’t. For example, your title should be enclosed in <h1> and your paragraphs should be enclosed in <p> and your <input>s should be labeled…

I noticed your team’s site (SPAM’s) uses standards (and looks very nice, might i add, as long as you have 1024 x 768 or higher screen resolution) but isn’t all that semantically correct for example. Not bad, but not great; there are a lot of double line breaks, excessive <h1>s and improper uses of lists.

Anyway, enough about that. Just remember, this stuff is easy to learn, and very tough to master. One last thing, W3Schools is a good place to go to learn about this stuff.

Thanks, but I am a big hurry to get the site up and running for the customer. I think it will work in most browsers and I can fix the errors latter on so that it will run better in more browsers. For the time being, should I change anything in that <DOCTYPE> tag?

Also, thanks for that great explanation. I learned a lot more from that then from the Lycos tutorial on website validation. Good job and thanks.

No prob.

If I saw the site, I could give you a more informed answer, but what you have looks good.

The errors sounded so rediculous. I didn’t know that you can’t use the <br /> tag. It said there is no such thing as the “bgcolor” attribute of the <body> tag. It said there is no “name” attribute of the <a> tag. These sound so rediculous.

It is because W3C is starting to get rid of html attributes and go to using CSS. Of course CSS does make everything more organized and easier to use and can do anything you can do with the attributes. For example your to do your background color in css would be done like this in between the headers tag:

<style type="text/css">
body {background-color:insert color here;}
</style>

My website (if it ever gets finished) will entirely be coded with CSS and just a bunch of span tags.

For example, your title should be enclosed in <h1> and your paragraphs should be enclosed in <p> and your <input>s should be labeled…

Isn’t there a reason for this though?? I read about this and it is relatively new. I just can’t remember the reason though. Can you tell me why?

*Originally posted by robot180 *
**Can someone explain what w3c validation is?

I was told to put this code at the top of my html documents in my website.


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN" "http://www.w3.org/TR/REC-
html40/loose.dtd">
 

Then I was told to go to this website and enter the URL of my website. It said there was 29 errors even though I made sure there were no errors in the entire website.

validator.w3.org

The errors sounded so rediculous. I didn't know that you can't use the &lt;br /&gt; tag. It said there is no such thing as the "bgcolor" attribute of the &lt;body&gt; tag. It said there is no "name" attribute of the &lt;a&gt; tag. These sound so rediculous.

Can someone help me out? **

Actually, <br /> is valid, I think for only XHTML though (it’s the surpasser (sp?) of HTML according to the W3C site, and W3Schools.com).

The name attribute has been replaced by “id”, and for coloring (like the bgcolor tag), the standard is becoming CSS (style sheets) now (like what Adam said). Except for style sheets, to make it compliant, I think you need to use hex numbers (like #000000 = black, #FFFFFF = white, #808080 = dark grey).

CSS isn’t dependent upon what language you use (HTML or XHTML). I personally think you should always make it compliant with W3C standards, but that’s just my personal opinion. My FIRST site is compliant in both XHTML and CSS, which makes it better for other browsers to view it in, besides IE 6.

Except for style sheets, to make it compliant, I think you need to use hex numbers (like #000000 = black, #FFFFFF = white, #808080 = dark grey).

I just checked my CSS five mintues ago with the validator and it mentioned nothing about using the hexadecimal numbers. It works just fine with the color’s names.

Actually, <br /> is valid, I think for only XHTML though (it’s the surpasser (sp?) of HTML according to the W3C site, and W3Schools.com).

It really should not be that hard to learn XHTML. I just took the test on the XHTML language on w3schools.com and I got an 85 on it after just glancing through the guide.

<br /> is valid only in XHTML, because it is an XML-style open/close tag. In XHTML, you must close all your tags, so you could concievably go <br></br>. I don’t suggest you use XHTML, as it’s a largely unsupported language, a reformulation of HTML as XML. It is not as of this moment, designed to replace HTML, and in fact there is no reccomendation that introduces anything new, other than its architecture. The latest (and final) version of HTML is version 4.01, which is what you should normally use.

The name attribute was not replaced by id; they serve different functions. The id attribute is something for things like scripts (i.e. getElementById) and styles (#textbox) to lock onto, and also can be used for semantics. The name attrubute explicitly specifies a purpose, such as in a form, “email” would be the name you give to the form input for an email address so that a script or browser can identify what information is being posted. In stylesheets, you don’t need to use hex numbers. Black and red for example, can be entered in. Also, an RGB value can be used.

Standards are great usually. Please though, don’t be under the misconception that writing for a standard will make a page easier or better in some way. Often it isn’t.

I don’t suggest you use XHTML, as it’s a largely unsupported language, a reformulation of HTML as XML.

Ummm… That one website you showed us was formated with XHTML. It really sure does look nice for something that isn’t unsupported.:slight_smile: It really doesn’t look like XHTML would be a problem to use since all it uses is HTML from what I can tell.

*Originally posted by Adam Y. *
**I just checked my CSS five mintues ago with the validator and it mentioned nothing about using the hexadecimal numbers. It works just fine with the color’s names. **

I’d like to state that I said “you MIGHT need to use hex numbers”, not “you HAVE to use hex numbers”.

<br /> is valid only in XHTML, because it is an XML-style open/close tag. In XHTML, you must close all your tags, so you could concievably go <br></br>. I don’t suggest you use XHTML, as it’s a largely unsupported language, a reformulation of HTML as XML. It is not as of this moment, designed to replace HTML, and in fact there is no reccomendation that introduces anything new, other than its architecture. The latest (and final) version of HTML is version 4.01, which is what you should normally use.

The name attribute was not replaced by id; they serve different functions. The id attribute is something for things like scripts (i.e. getElementById) and styles (#textbox) to lock onto, and also can be used for semantics. The name attrubute explicitly specifies a purpose, such as in a form, “email” would be the name you give to the form input for an email address so that a script or browser can identify what information is being posted. In stylesheets, you don’t need to use hex numbers. Black and red for example, can be entered in. Also, an RGB value can be used.

Standards are great usually. Please though, don’t be under the misconception that writing for a standard will make a page easier or better in some way. Often it isn’t.

I said <br /> was only XHTML standard. XHTML isn’t much different than HTML. According to W3Schools it’s supposed to suprass HTML.

Name was replaced by id in XHTML…

id is only used for images though I think, but it might be used for others also.

RGB values can be used, yes.

But if someone wants a standard (a.k.a. compliant) website, then they should use standard coding.

Am I the only one that has even attempted XHTML?

*Originally posted by Raven_Writer *
**I’d like to state that I said “you MIGHT need to use hex numbers”, not “you HAVE to use hex numbers”.

I said <br /> was only XHTML standard. XHTML isn’t much different than HTML. According to W3Schools it’s supposed to suprass HTML.

Name was replaced by id in XHTML…

id is only used for images though I think, but it might be used for others also.

RGB values can be used, yes.

But if someone wants a standard (a.k.a. compliant) website, then they should use standard coding.

Am I the only one that has even attempted XHTML? **
In the future (namely when version 2.0 is recommended), XHTML will introduce concepts not found in HTML, which is not going to be updated anymore. Name was not replaced by id. They serve the same function in HTML 4 and XHTML 1, and both are valid. Id is for any element, whereas name isn’t supposed to be. Id is used alongside class in CSS1 core to identify elements (like #textarea {color: red;}). or spots in a webpage (see the link that says post #12 in the top right corner of my post?).

I write in HTML 4 and XHTML, depending on the site. Just like how many think that validating makes their code ‘better’, I think a lot of people use XHTML just because it’s new and they think they are somehow writing better code. Really though, the X doesn’t make you 1337 :slight_smile:

*Originally posted by jonathan lall *
**In the future (namely when version 2.0 is recommended), XHTML will introduce concepts not found in HTML, which is not going to be updated anymore. Name was not replaced by id. They serve the same function in HTML 4 and XHTML 1, and both are valid. Id is for any element, whereas name isn’t supposed to be. Id is used alongside class in CSS1 core to identify elements (like #textarea {color: red;}). or spots in a webpage (see the link that says post #12 in the top right corner of my post?).

I write in HTML 4 and XHTML, depending on the site. Just like how many think that validating makes their code ‘better’, I think a lot of people use XHTML just because it’s new and they think they are somehow writing better code. Really though, the X doesn’t make you 1337 :slight_smile: **

According to the W3 Validator, the id attribute is required, and does replace the name attribute (XHTML only, NOT HTML, and I’m not saying also for HTML!). id isn’t just for (if it all) CSS (at least 2 from what I’ve been reading).

I write in both also, doesn’t mean I’m using XHTML just because it’s “new”. I use XHTML more than HTML because I prefer to code the XHTML way. XHTML is also easier to read XML data IMHO (since the X means that same in both XHTML and XML). If someone wants to use HTML, let them. If someone wants to use XHTML, let them. I don’t see how you can judge people that they use XHTML because it’s new. That’s like saying everyone is using PHP because it’s better than ASP, or ColdFusion.

Edit: As Adam said, the W3Schools site link you posted was converted to XHTML. Read why they did it. It’s not because it’s new either…

Time for an example: I have a form, which I will call “contact”. It sends an email to me containing a user’s name through PHP or Perl or whatever.

<form id="contact" method="post" action="emailer.cgi">
    <label for="formname">Name</label>
    <input type="text" name="name" id="formname" size="20" />
</form>

In this scenario, the id attributes allow for any DOM (Document Object Model) script or stylesheet to apply rules to a specific element. The id attribute in the input element is purely semantic and denotes that the label applies to it (see its for attribute). The name attribute in that same input is in this case there so that the CGI script knows what it’s getting and so the browser knows what its inputting. If, for example, I typed in my name before, in another “name” form, my browser might see that I’m typing “Jo…” in the “name” field and offer to autocomplete it for me, because it knows my name is Jonathan. Good browser. You’ll note also that this validates.

By the way, I wasn’t meaning to refer to you when I said that, “I think a lot of people use XHTML just because it’s new and they think they are somehow writing better code. Really though, the X doesn’t make you 1337 :).” Just to clear that up. W3Schools did it because they could, and because they knew it would have to be done eventually if they were going to preach about XHTML. I believe that page states more about how they did it than anything. I’ve read it before, but couldn’t find it; I think they used HTML Tidy, but they might’ve done it by hand, I don’t remember.

Edit:
Hooray for typos! I also haven’t been clear. I should point out that name can be looked upon as being a replacement for id, and in some specs is deprecated for that exact reason, but it is also absolutely required in certain elements, like form and meta for example. One should never use id instead in these cases. My example is one of the only truly kosher ways to put name in, as forms have always behaved in this manner. Also, one could also use name and id as seperate identifiers for a script should the need arise.

I skimmed through your posts. Sorry if you asked me something and I missed it.

I am not sure if I am aloud to post links to the site in places like this, so please try not to get me fired. It is for a center for the blind so it is in large print, audio, and braile.

http://www.20-200fellowship.org/

I used bgcolor because if I used a stylesheet it would ignore the external stylesheet. I can fix that, but it is a lot faster to just put a bgcolor in the body tag. I only did it once, I think.

It is funny that the charts say that someone from Singapore went to my site at about 6 in the morning last night. Hey Brandon or someone with a domain, is it common to find that. I never did anything with the site and search engines, which would be my next question.

A blind people’s institute? Then you really have to go for heavily semantic-based pages and accessibility. check this out.

Again, semantics will help you out with search engine spiders. things as simple as <h1> tags for titles will let them know what your page is about for example.

New question!
What do I do about putting the site on search engines? Does it cost money or do I just submit the link. I saw a thing in the web shell to submit a link to like google and stuff.

*Originally posted by robot180 *
**New question!
What do I do about putting the site on search engines? Does it cost money or do I just submit the link. I saw a thing in the web shell to submit a link to like google and stuff. **

Usually just including a META tag will do it sooner or later.

http://www.htmlclinic.com has a good META tag generator.

I might be wrong on this though.

search engines don’t just throw random urls in and hope that a site comes back.

if your site is linked to sites that are linked to, you will get searched

btw: meta tags are semi-useless for actually getting listed/good standing in a search engine. they MIGHT be used as a description of the page, but ultimately, keywords have to be in the content of your document.

compliance is good. because your html is compliant doesn’t mean it is necessarily structurally sound and all that, but, heh.

Also, it’d help LOADS if you actually had provided a link so we could go through your source? Anyway, what needs to be said has been said. Validation is not a be all end all. BUT! Validation is good, and so are standards. If it weren’t for standards we’d have to go back to code branching and updating multiple pages for each browser. Its a bit hard to get used to coding “properly” but once you learn how (or if you never learnt the “tagsoup” style of HTML in the first place) all of a sudden, everything works, and validation isn’t a huge pain.

@adam: a website full of span tags is as bad as a site full of tables. Both are meaningless semantically/structurally. Headings are h1/h2/h3/etc, use <p> for paragraphs, and so on. Spans are just generic containers that don’t really hold much value in terms of describing content. Describe the content, and you have style hooks for CSS without having to resort to excessive amounts of classes/IDs

BTW: Isn’t ridiculous spelt with an i not an e? :smiley:

I am having some trouble understanding some of this. I interpreted it as saying that I should concentrate on the h1,h2,etc. tags and p tags, but leave out some of the div tags and span tags. I used the div tags though to reposition some stuff on the home page. That is the only place I remember using them. The articles that are on that website are not typed by me. I just put some p and h tags in to make headings, subheadings, and paragraphs from the plain text document of the monthly newsletter. So, anyways, the div and span tags are more for me and for shortcuts to styles, like some of you said.

My webshell has a thing that says to submit a link to search engines. I noticed google and lycos on the list so I might do that, but I wanted to make sure it didn’t cost anything and that I don’t need coding, like meta tags, for it to work.