![]() |
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. Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0validator.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. |
Quote:
Code:
<style type="text/css">Quote:
|
Re: w3c validation?
Quote:
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. |
Quote:
Quote:
|
<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. |
Quote:
|
Quote:
Quote:
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? |
Quote:
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 :) |
Quote:
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.
Code:
<form id="contact" method="post" action="emailer.cgi">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. |
| All times are GMT -5. The time now is 00:16. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi