• 6 May

    Because the web is a changing and ever evolving organism, it’s important to build sites that can grow with it and easily ride the current instead of drowning when a new wave approaches.

    Clean markup and building with web standards not only helps you do this, but will save you both time and money in the long run.

    As the web expands, so the technologies that it uses grow with it. While HTML has been around for a long time, it has acquired quite a few sidekicks along the way.

    First Javascript, then CSS, XML and later AJAX. Wide adoption of HTML 5 is just around the corner, with Firefox, Safari, Opera and Chrome already enjoying nearly full HTML 5 support (the slow kid on the block, Internet Explorer, is lagging behind as usual).

    In this article, we’ll review the basics of web standards, what they are, what they mean to you, and some important tips to help you deal with this important and often neglected issue.

    What Does it Mean to Have “Clean” Markup?

    Simply put, it means free of clutter, standards-compliant, and using the tags and structures of each language for their intended purpose.

    Clutter-free HTML makes sparse use of tags, eliminates the extraneous and accomplishes its task with as little markup as necessary. It avoids needless attributes, such as inline CSS, and leaves each document structured and organized.

    Likewise, clutter-free CSS should avoid repeating itself, take advantage of inheritance (remember, CSS stands for Cascading Style Sheet) and re-use classes whenever possible.

    Standards-compliant means that your pages validate with the standards laid out by the W3C for HTML, CSS, and XML. It means using the free W3C validators to check for errors, correcting them and testing again until you’re as close to 100% valid as possible.


    Why Should I Care? It Works, Isn’t That Enough?

    Every project has an aggressive deadline and every client wants their site launched yesterday. So as web developers and designers we are under constant pressure to work faster and more efficiently.

    It’s easy to fall into the trap of thinking fast must mean sloppy, and that clean, standards-compliant markup takes more time. It’s easy to just say “it works and that’s all that matters.”

    Sure, it works… for now, for you. What about next year, or three years from now? What about new browsers? What about accessibility?

    Do you really think that the major search engines will adhere to special, sloppy coding methods? They’re finicky, and if you are not standards compliant you’re kicking your search ranking in the face.

    What about the next poor sap that has to edit these pages you’ve created? What happens if you get hit by a bus, quit to go backpacking in Alaska, or get abducted by aliens? Someone else has to pick up where you left off and he’ll be looking at your code, trying to make sense of it. Will it be easy, or will it give him a headache and make him curse your name?

    Do it right the first time. This isn’t just some annoying, fatherly life-lesson. It will actually save you both time and money, and make those that follow you have an easier time of things.

    You may think it’s faster to just drop in the inline CSS instead of properly adding a new class to your style sheet. And you may think it’s faster to toss in whatever HTML you can spit out without considering the overall document structure.

    When it comes time to update that document later or redesign the whole site, you’ll spend much more time making up for sloppy code than you ever saved by rushing through it in the first place. When you create a new style sheet, those pesky inline styles you hastily added will come back to haunt you and you’ll spend hours hunting them down and stripping them out.


    Extensibility, Accessibility, Translation and Future Proofing

    Mobile browsing is growing like Godzilla on atomic-steroids. Instead of being relegated to the jet-setting Blackberry addicts from 5 years ago, today everyone is using their phone to surf the web.

    Assistive technology -screen readers for the blind and alternate interface devices for the handicapped- is common, and you don’t want to lose a sale or alienate traffic just because you didn’t take that into account.

    Your site is likely to be translated into a half-dozen languages as readers from around the world find your content. Thanks to the Internet Archive, Google’s cache and others, pages you publish today will be around for a long, long time even after they’ve been removed from your live site.

    Clean markup and standards-compliance will go a long way to ensure your sites work in each of these scenarios.


    Do’s and Don’ts:

    • DO use tags as they are intended. For example: h1 is the first top-level element on the page, then h2, h3 and so on. There should only be one h1 tag per page.
    • DO name your CSS classes and IDs using meaningful terms, and ask yourself if someone else will know what a class/ID does from its name alone. Which naming convention makes more sense: #box12 or #comment-footer?
    • DO make good use of CSS inheritance. For example: if you set a font on a container, you don’t need to specify it again on every child element unless that child element needs to use a different font. This will keep your style sheets lean and quick to load.
    • DO validate your HTML, CSS and XML and correct as many errors as possible. Pay attention to the warnings generated as well.
    • DO double check WYSIWYG generated code and clean up as necessary. They’re notorious for spitting out bulky, bloated markup with loads of unnecessary, invalid junk.
    • DON’T inject inline styles or extraneous tags and attributes just because you’re in a rush.
    • DON’T settle for “it works.” Just because a page renders it doesn’t mean that the markup under the hood is standards-compliant, problem-free or search engine friendly.


    Further Reading & Resources


    Written exclusively for WDD by Jeff Couturier.

    Do you follow web standards in your websites? Why or why not? Please share your comments with us.


  • 57 Comments »

     
    #1
    Nikki
    May 6th, 2009 at 7:38 am

    So many great points! Clean markup DOES matter. Thanks for a great article.

     
     
    #2
    Doug S.
    May 6th, 2009 at 7:48 am

    Actually the one H1 per page rule is not a rule at all. Google recently ruled in from an SEO point of view and stated that multiple H1s was not going to negatively effect you and that it was perfectly OK as long as the situation warranted multiple H1 tags.

    From a screen-reader usability perspective, however, I would imagine one H1 to be beneficial but other than that?

     
    2 Replies
     
    #3
    serj
    May 6th, 2009 at 7:52 am

    verry good info you give there. great article!

     
     
    #4
    Brad
    May 6th, 2009 at 8:48 am

    What about speed?

    Using clean markup and web standards can significantly increase the speed at which your site loads.

     
     
    #5
    KAMAL
    May 6th, 2009 at 10:05 am

    Good post!

    It was a useful article for web designers and programmers.

    Thanks.

     
     
    #6
    Hugo
    May 6th, 2009 at 10:54 am

    Hey I got a question: After you’ve finished a project, does anyone use CSS/Javascript compressor tools to make the files smaller and save bandwidth? I mean the tools that smash all you organized code into one line by deleting all whitespace and comments. Reason why I’m asking this is that compressed code is like unreadable (equals ‘not clean’?), but at the same time you save several kilobytes.

     
    2 Replies
     
    #7
    shiido
    May 6th, 2009 at 11:23 am

    very useful article, i think Ie is somehow slowing us down, in this top speed INTERNET grow…

     
     
    #8
    STPo
    May 6th, 2009 at 3:27 pm

    Doug S. is right, several H1 on the same page are OK. What’s the problem with the screen-reader usability?

     
     
    #9
    Matt Ward
    May 6th, 2009 at 3:38 pm

    Yikes. I admit I am a bit guilty of overusing inline styles, but your post has convinced me to take more time to take more time with my style sheets! Thanks!

     
     
    #10
    Kevin
    May 6th, 2009 at 3:55 pm

    Great post. I’m always put off but the “just get it done” mentality. Take pride in your work, take the time to do it right and you’ll always come out ahead.

    I know too many “web developers” who think a job well done is one that you can bang out in 2 hours and then they rationalize by saying “the client will never look at the code”. Not good and definitely not very professional.

     
     
    #11
    Luis Ahmed
    May 6th, 2009 at 3:58 pm

    Clean Markup and the use of standards are not only a necessary practice, we have to make web sites semantically correct and it includes every issue touched by this post and some others. Thanks for share the ideas, great post.

     
     
    #12
    Realizzazione Siti Web Bologna
    May 6th, 2009 at 4:38 pm

    very useful the “Do’s and Don’ts” list

     
     
    #13
    Gabe Harris
    May 6th, 2009 at 5:13 pm

    Thank you for mentioning “the next poor sap” that has to inherit your code. I cringe at the thought of taking on existing projects because experience has taught me that so many developers just don’t care what their code looks like in the editor. I have a similar post on my blog talking about cleaning up css files here: http://tinyurl.com/ct7p3j

    Maybe even more important than the “next poor sap” – what if that poor sap is you?!?!? I know I don’t like revisiting projects that I have been thinking of as “complete” for months or years, but I do feel much better when I go back to the site and the code is crispy clean!

     
     
    #14
    Dixie Vogel
    May 6th, 2009 at 5:51 pm

    Some wonderful points here! I would add a couple.

    1. Clean markup is less likely to break in obscure browsers.
    2. Carefully constructed markup allows you to change styles sitewide very easily, and if it’s done very well, you can do a whole redesign via straight CSS.
    3. Cleaner, leaner code means faster loading pages. Everybody likes that!

    This message can sometimes get lost in the push to produce and the fact clients don’t understand the value of what’s under the hood nearly as much as what they can see. But taking pride in your work invarabily pays off.

    Thanks for the article!

     
     
    #15
    SaraKate
    May 6th, 2009 at 5:58 pm

    As someone who is just learning to create a website from scratch, I find this post extremely important. Not only is clean markup easier to learn (Why would you clutter up markup anyway? Doesn’t seem to benefit anyone involved.), but also easier to edit for people who don’t do web design or development for a living. I work for a small non-profit and am re-designing our website from scratch. The current site looks as if everything was created with Dreamweaver in WYSIWYG format instead of hand-coded, which gives a lot of extra (useless and hard-to-read) bulk. It has created a lot of problems, which I am hoping to avoid in the future by hand-coding with clean and simple markup in the next version of our site.

     
     
    #16
    Chris Reynolds
    May 6th, 2009 at 6:17 pm

    Couldn’t have said it better myself! Excellent post on a very important topic. Nice job!

     
     
    #17
    insic
    May 6th, 2009 at 6:29 pm

    Now I have a solid reference when somebody ask me why they need to validate their markup. As I recall, I tried to explain this to lot of people like my teamate :) but they refuse to listen sometime.

    Very nice article

     
     
    #18
    cssah
    May 6th, 2009 at 6:47 pm

    very useful thanks so much

     
     
    #19
    darrenalawi
    May 6th, 2009 at 6:59 pm

    Some very good points Alvaro, it’s really difficult to quantify the benefits of clean standards compliant code, if we all took the attitude that ‘if it works, leave it’ we would never improve.

     
     
    #20
    Adam
    May 6th, 2009 at 7:17 pm

    We make sure all of our sites are compliant unless there’s a valid reason not to. At the end of the day it’s not hard to do – you can often go from 100 to 2 errors just by removing or adding one tag!

     
     
    #21
    stk
    May 6th, 2009 at 7:22 pm

    As a designer, we often ask clients, “Do you want it done right or done fast? Because if you want it done fast, you’ll be calling us in to fix stuff.”

    Understand @ following behind sloppy coders (believe me) but in the real world, the person hired to pick up where you left off, will often bash your work – regardless. It’s human nature, eh?

     
     
    #22
    Chris Gray
    May 6th, 2009 at 7:26 pm

    Great article. Markup text seems so hard to keep up with these days. I feel like Internet Explorer sometimes!

    So helpful that I tweeted about it.

    Chris G

    Twitter ID: @goglobalwebs

     
     
    #23
    web design greenville
    May 6th, 2009 at 7:26 pm

    I couldn’t agree with you more. Its so funny how the “it works fine” excuse seems to pop up all the time.

    I think a lot of it has to do with knowledge. I was fortunate to start my dev career with a bunch of people to bounce ideas off of and to show me the best way to do things.

    Now it’s just second nature to make sure every page is as clean as possible and validates. But if you never had that mentoring then figuring out the best and cleanest way to write code can seem like a painful addition to any project.

     
     
    #24
    AYANO
    May 6th, 2009 at 7:29 pm

    I can’t stand messy mark-up. Even though I didn’t learn much new I’m going to show this article to my friends who are satisfied with “it works”-excuse. :)

     
     
    #25
    Amy
    May 6th, 2009 at 7:38 pm

    What a great reference article. I’m continuously reminding clients of the importance of clean markup. I’ll be sure to bookmark and share.

    Thanks!

     
     
    #26
    Joe
    May 6th, 2009 at 10:06 pm

    Great post – very “to-the-point” and without the clutter of over-explaining everything. One point/tip I’d like to give: you mention above “DON’T inject inline styles or extraneous tags and attributes just because you’re in a rush”. In my experience, I find it useful to TEMPORARILY use inline tags for designing/testing purposes. Once I achieve the desired result, be it visually or functionally, I move the CSS code to the actual stylesheet and leave the page as clean as possible.

     
     
    #27
    Dan Hauk
    May 6th, 2009 at 10:54 pm

    Great article! So glad to see others reflecting my own views. I always take a look at the code of the beautifully designed sites that I come across. And it always makes me cringe when one of those sites has ugly code. It’s just one of those things you can’t rush, and you’ll be much happier and satisfied when you do it right the first time.

     
     
    #28
    Web Design Brisbane
    May 7th, 2009 at 1:02 am

    Couldn’t agree more.
    I usually use the validator over at W3C to see what my code looks like.
    I think the other important thing is that what works now might not work later on as browsers change and update especially if your code contains errors.

     
     
    #29
    Web Design Dallas
    May 7th, 2009 at 5:26 am

    Great article!!!! (New to the site and loving the content)

    Now only if I could get my team to understand the importance. Taking of the lead designer/developer role from a person that did the complete opposite of this article makes my life a living hell everyday trying to sort through the mess!!!

    Keep up the great work!!!

     
     
    #30
    UPrinting.com Printing Services
    May 7th, 2009 at 7:31 am

    Exactly, with how fast the technologies are advancing, like, there’s always a new and improved browser about to be launched, we won’t know if what we’re using right now will still be applicable in the future. Thanks for this very informative post :) Really enjoyed reading it.

     
     
    #31
    Vince
    May 7th, 2009 at 9:40 am

    I don’t think there’s much truth in any of this. Search engines are not picky as this article suggests. Google built their search knowing that not everyone follows standards.

    Its ok to have clean markup, but at the end of the day, the average user never sees your code. If your site works perfectly in all major browsers your job is done.

    Markup is something that gets good with experience.

    My opinion is don’t spend too much time on presentation or how clean your markup is. It will improve over time anyway. Get your site working and move on.

     
     
    #32
    Guillaume
    May 7th, 2009 at 12:30 pm

    Great article! I totally agree with all these points. Plus, standard-compliant websites improve search engine indexation. There’re only benefits of using such markup.

    Keep writing in this way ;)

     
     
    #33
    Jan
    May 7th, 2009 at 1:01 pm

    Great post! Thank you!

     
     
    #34
    rahul sahu
    May 7th, 2009 at 1:49 pm

    wow! great point. this infomation very use full…

     
     
    #35
    Mark
    May 7th, 2009 at 3:42 pm

    Inline css cannot be avoided specially with templates that have complex design…it helps lessen your external css.

     
     
    #36
    WORDPRESSGALA
    May 7th, 2009 at 4:28 pm

    Thanks!
    Very good and useful article for all web designers and programmers.

     
     
    #37
    Anju
    May 7th, 2009 at 6:49 pm

    Really nice post.

     
     
    #38
    AGuzman
    May 8th, 2009 at 12:00 am

    Thank you all for your kind comments and thoughts! Clean mark-up is necessary and it keeps every piece of element organized while increasing the standard of how we design websites. Plus, practicing clean mark-up is very beneficial to our coding skills.

     
     
    #39
    Sarah
    May 8th, 2009 at 12:11 am

    Great post! All is too true.

    @Doug S.: I completely agree with you on that one point. One h1 tag per page just doesn’t work when it comes to a blog, for instance. Otherwise, I think that does make for a good general rule.

     
     
    #40
    macias
    May 8th, 2009 at 12:46 am

    be valid or die ! :)

     
     
    #41
    Patricia
    May 8th, 2009 at 1:40 am

    boy oh boy did I need to read this…

     
     
    #42
    Denver SEO
    May 8th, 2009 at 6:59 am

    This was a great post Well written, and to the point. From an SEO standpoint, nothing is more frustrating than getting a new client and trying to decipher the clutter of a poorly designed site, and then cleaning up that code to make it more search engine friendly.

    I wish more designers would follow the spirit of this post and do it right the first time. Great design = great results.

    BTW -love the design of this blog!

     
     
    #43

    Hi an awesome site where you can find a good information ,which is very useful .Thank you

     
     
    #44
    Jim S.
    May 10th, 2009 at 7:28 am

    Great points made here. You can really speed things up as well by using CSS sprites, reusing/re-purposing/repositioning background images, and compressing and combining your CSS/JavaScript etc. A well inherited stylesheet is a lean, mean, work of art. You also level the browser playing field somewhat by adhering to standards (like not starting your code on the 1st line puts IE6 in quirks mode), and it helps assistive technology when aiming for ADA or 508 compliance.
    Thanks!
    ~ Jim S.
    ~ tweet: @seo_web_design

     
     
    #45
    Chris Ruppel
    May 13th, 2009 at 1:10 am

    Clean markup is only the first step toward creating truly meaningful content. Once you have the art of semantic HTML under your wing, you’re in a better position to add more machine-readable data to your content via microformats and RDFa.

    http://google.com/support/webmasters/bin/answer.py?hl=en&answer=99170

    Major search engines are beginning to ramp up adoption of rich search results using Microformats and RDFa embedded in XHTML documents. So in addition to specifying proper hierarchy via HTML, developers will be able to tell the search engines that the content is a movie review, a product for sale, etc. You cannot add this new layer of rich information without first organizing the basic elements properly.

    Semantic HTML will eventually be mandatory, rather than a strong recommendation, for anyone wanting their website to appear as a rich, useful search result.

     
     
    #46
    Thomas
    May 24th, 2009 at 1:58 am

    Great to see that someone takes the time to explain WHY web standars are important! Well done, keep it up!

     
     
    #47
    web designing
    May 30th, 2009 at 12:22 pm

    It is a good blog, nice content also. Thanks for sharing such a good blog.

     
     
    #48
    Costa blanca repossessions
    July 9th, 2009 at 1:06 am

    Very interesting take on the whole clean mark up issue. I learned a lot from this post, thanks.

     
     
    #49
    MMORPG
    July 13th, 2009 at 7:34 am

    Of course it matters. It allows search engines to better spider your sites and better ensures cross – browser compatibility.

     
     
    #50
    Jay
    July 17th, 2009 at 5:58 pm

    Browser compatibility is truly essential. Additionally, as an SEO, it frankly sucks working with websites written in horribly messy code…they increase the suicide rate among developers. :)

     
     
    #51
    sbs sonuçları
    July 22nd, 2009 at 1:27 am

    Very interesting take on the whole clean mark up issue. I learned a lot from this post, thanks.

     
     
    #52
    mushroom website design
    August 19th, 2009 at 11:37 am

    Clean coding and Clean markup are 2 principles you must follow. Theres nothing worse coming back to a job and its been over coded and complicated. Keep it simple, stupid! lol Thanks

     
     
    #53
    seo
    October 8th, 2009 at 11:22 am

    So very, very true and well said. Do it once, do it well is the best motto anyone could live by and never is it more true than in website design and seo. There are so many clients who want fast results and of course like buying a new car, as long as it looks good and goes then it should be okay. No need to worry about under the hood. Not until something goes wrong and then it has to be fixed. Web standards should be followed and I think this should also be one of the criteria that people choose their web designer on. A simple question ‘do you use clean code and follow web standards’ the more we get it out there the less likely people will be to get ripped off by so-called designers just looking to make money. People who do any job because they love doing it will always want to do the very best job they can, mostly because they can’t stand the thought of their work being out there and not being the best it can be. Thanks for the great post.

     
     
    #54
    Otimização de Sites
    October 22nd, 2009 at 9:33 pm

    This is fact. I have observed that the majority of Web site developers are not very concerned with the future trends, and the result is only one: disaster in the future. Even in SEO, many do not bother and end up not getting any results with their projects.

     
     
    #55
    punk
    October 23rd, 2009 at 2:31 am

    Great Post. I really like your Blog.

     
     
    #56
    Chotrul Web Design
    December 17th, 2009 at 10:46 pm

    .. and it matters because of SEO concerns too … if it’s really bad junk code it’ll impact your rankings.

     
     
    #57
    m65 field jacket
    January 29th, 2010 at 11:02 pm

    just the other day someone asked why he needed to validate his markup..i will send him here

     
    Name (required)

    E-mail (required - never shown publicly)

    Web-site

    Your Comment (smaller size | larger size)

Home| Advertising| About| Contact

© 2010 All Rights Reserved