/    Sign up×
Community /Pin to ProfileBookmark

code validator – what for?

Hi There.

Lately, I’ve seen a lot of websites using the the HTML pr theCSS validators. As we all know, there’s a lot of websites that don’t validate their code but still looks good.

My question is Why do I need to validate my code?
What’s the benefit the website is getting out of it?

Thanks!

to post a comment
Full-stack Developer

12 Comments(s)

Copy linkTweet thisAlerts:
@Stephen_PhilbinNov 09.2004 — Valid html is *guaranteed to work no matter what device is accessing it. The basic principal behind html validation is to ensure your document is "well formed". If a document is well formed, then it has a standard shape/format. If something is standardised, then many different things can prepare to use the standard.

Analogy: It's standard for fire to make heat. So no matter who is cold, they always know that lighting a fire will make heat. It's something everyone knows about, so everyone can use it.

Although your question seems to be going more down the road of "why do we light fires to make wood black?". Well the fact is, we don't. In exactly the same way that we **don't use html to make a document look like anything. Valid markup looks exactly the same as invalid markup, because neither [i]look[/i] like anything. HTML gives structure and meaning to a document, nothing else. A valid html document has meaning, an invalid document is meaningless.

As for the black wood...... Wouldn't black paint have done a better job? That is afterall what it is for.

EDIT: (forgot the asterisks)

  • * guaranteed to work with any web browser. A web browser is built to take in the mark up and understand its meaning and be able to convey that meaning to another. A file browser will merely interpret it as text or in some other way.


  • ** The purpose of HTML is not for creating visual effects and so should not used in such a way. However many people still do. So that's a don't as in shouldn't.
    Copy linkTweet thisAlerts:
    @NogDogNov 09.2004 — Certain browsers (especially IE in "quirks mode") will sometimes be able to handle invalid HTML by [i]assuming[/i] what the author meant to do. Valid HTML requires no assumptions by any compliant browser, thus giving you the best chance that your page will display correctly on all compliant browsers [i]and other web-enabled devices.[/i]
    Copy linkTweet thisAlerts:
    @weeeauthorNov 09.2004 — I did this page with CSS and:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    And it doesn't look ggod at all on FireFox.

    The problem is that I told my customer that I'm going to build his website with the higher standart (strict) and he asked me why and I wasn't sure what's the best answer(s).

    Can you give me a few? ?

    Thanks!
    Copy linkTweet thisAlerts:
    @David_HarrisonNov 09.2004 — [i]Originally posted by Mr Herer [/i]

    [B]Valid html is *guaranteed to work no matter what device is accessing it.[/B][/QUOTE]
    I'm afraid that's not true. It is perfectly possible to create a totally valid HTML 4.01 Strict or XHTML 1.1 page that nests tables 12 deep. A hand held device wouldn't have a chance of displaying that page properly, braille displays and screen readers would probably also choke to death on it.

    [i]Originally posted by Mr Herer [/i]

    [B]Valid markup looks exactly the same as invalid markup, because neither [i]look[/i] like anything. HTML gives structure and meaning to a document, nothing else.[/B][/QUOTE]
    [i]Originally posted by weee [/i]

    [B]I did this page with CSS and it doesn't look ggod at all on FireFox.[/B][/QUOTE]
    Then you must be experiencing differences due to the different interpretations of CSS in both browsers.
    Copy linkTweet thisAlerts:
    @Stephen_PhilbinNov 09.2004 — Well maybe I could have worded that better. When I said work, I meant the structure will be understood. I didn't mean that it would in any way render/fit on the screen correctly. What I was getting at was that so long as it's a well formed document, the browser can easily identify the 7th level nested table of a 12 nested design. The structure is understood because it is well formed, it doesn't have to guess at what level or cell something is in because of missing or erroneous tags.

    Or do you actually mean that there are actually some modern browsers that can't construct the structure of such a table set in its memory?

    I wasn't talking about visual rendering or semantic value, just that the purpose of validity guarantees that the structure of the document will be understood.
    Copy linkTweet thisAlerts:
    @weeeauthorNov 09.2004 — a few good reasons why I should do it?
    Copy linkTweet thisAlerts:
    @russellNov 09.2004 — There are going to be those out here who disagree with me (I already know who a few of 'em are lol) but I think you answered your own question

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    And it doesn't look good at all on FireFox.
    [/quote]


    There's your answer. You have restricted your audience, or at least given some users a LESS rich experience by enforcing strict interpretation. Try using a different dtd (or none at all) and test in various UAs.
    Copy linkTweet thisAlerts:
    @Stephen_PhilbinNov 09.2004 — [i]Originally posted by russell [/i]

    [B]There are going to be those out here who disagree with me (I already know who a few of 'em are lol) but I think you answered your own question





    There's your answer. You have restricted your audience, or at least given some users a LESS rich experience by enforcing strict interpretation. Try using a different dtd (or none at all) and test in various UAs. [/B]
    [/QUOTE]


    Well yeah I would disagree. You're not restricting your audience by using a strict DTD (you're actually more likely to be removing restrictions actually). When you use a strict DTD all you're doing is seperating your structure from your style. Using a strict DTD doesn't remove any (visually) creative options, it merely puts them where they belong. I most certainly wouldn't omit the DTD either. I fail to see how using a strict DTD would cause any modern browser to handle valid mark up incorrectly. I mean proper browsers will understand and use the DTD as it is meant to be and it doesn't make a blind bit of difference to IE because IE can't tell the difference between &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;

    and &lt;!doctype that I made up to show how dumb IE is&gt;

    Stick a link up to this document you have that is being broken by the dtd and say what the problem is.
    Copy linkTweet thisAlerts:
    @Joshua_N_Mar 05.2005 — I'm having trouble validating my site html.

    It says that all of these random things are wrong when I can't find anything wrong with it.
    Copy linkTweet thisAlerts:
    @Stephen_PhilbinMar 06.2005 — Link to the page you're having problems with? Or perhaps source? It's a bit hard to tell you what the problem is if we have no information of any kind about it.

    The mechanic has to see the car before they can tell you why it's not going brum.
    Copy linkTweet thisAlerts:
    @Joshua_N_Mar 06.2005 — [URL=http://www.fleet-of-particular-justice.x3fusion.com]Sorry about that, click here[/URL]
    Copy linkTweet thisAlerts:
    @buntineMar 06.2005 — As I always say, there are no true standards for the Web. Companies that release Web Browsers are not obliged to write code interpreters that conform to W3C standards. Even if your code is valid strict XHTML, there is no guarantee that it will work in every browser. Especially as new browsers become available in the future. Provided you know HTML very well, your site can look fine in an acceptable amount of browsers.

    One of my sites -- at www.buntinedesign.com.au -- works well enough (if not perfect) in every browser I have tested it in (I am not being definate here, as I havent tested it in the latest versions of some browsers). I dont know if it is valid HTML, I dont care. Neither do any potential clients.

    I recommend you write your markup so it validates, but I wont condemn you if you decide not to. The main reason for me is that if there is going to be a radical shift in Web Development, W3C standards will be turned to. But the industry can be entered into by [i]anyone[/i] -- you dont need a million dollars and a Computer Science degree --, all you need is a Web Browser. 75% of designers, espically Graphic Design/Digital Media graduates are going to adapt the attitude of "if it works, dont fix it".

    Regards.
    ×

    Success!

    Help @weee spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.17,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @nearjob,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,
    )...