Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Web Standards Introduction Web standards are designed to allow for interoperability between all web browsers, on every operating system, and even on every electronic device available. But is that really reality? Are all web browsers 100% standardscompliant? Are all web developers using web standards properly? Do web developers build a page using web standards, and then just walk away confident that their design will hold up everywhere? The really simple answer to that last question is no; while that’s an ideal situation, that is far from reality. In this article we'll be covering: • • • • The state of web standards adoption today How to check whether standards are being used properly on a site How many sites are using web standards properly The reasons people don't adopt standards Standards are Important! There are also some direct business reasons to consider. In general, using web standards improves a web site's position in search engine rankings (how high up it appears on the list when you do a Google search) and how easy it is to find in the first place. In addition, using standards and best practices will generally make the web page more accessible by people with disabilities trying to make use of it, and users trying to access the site on their mobile devices. Extra users and increased visibility is always good for business. The single biggest complaint from individuals who say that standards-based development is a waste of time is that it takes too long to learn to use web standards instead of outdated methods and develop web sites that work across all browsers. So why not start out by learning the correct way to do it, and save yourself some trouble? You’ve decided to learn how to build websites, and you need to do it one way or another, so why not learn how to do it properly from the beginning? How do you check for standards compliance? Before we go any further, the question you’re probably asking yourself is “how do you know if a web site uses web standards?” Does it look any different to any other web site? Yes and no. Web standards-compliant websites, if developed properly, should look no different from web sites coded using a jumble of hobbledtogether markup. However, the source code of the web site (try right/Ctrlclicking on a web site and selecting the “Source” or “View Source” option— the exact terminology varies between browsers) will look vastly different. A standards-compliant web site will have nice, clean markup with little or no formatting embedded in the page itself. It might be hard for you to notice this at a glance, but trust me, visually impaired individuals using screen readers and search engines will notice right away. We have already covered the advantages of using web standards in the last article. The easiest way to check for standards compliance is to use a handy tool, available online, called a validator. The World Wide Web Consortium (W3C) makes a validator freely available at http://validator.w3.org/. You can (and should) use this tool to check any web sites you’re developing for errors in your HTML. CSS can be checked out using the CSS validator available at http://jigsaw.w3.org/css-validator/. Feel free to click through these links, and test a few of your favorite web sites. Ensuring your pages validate is only half the battle. How do we check if browsers are standards-compliant? The Web Standards Project has developed a series of tests called the Acid tests, which use some complex HTML and CSS rules (plus some other markup and code) to see if a browser can render various test screens properly. The latest version of the Acid test, Acid3, is still a work in progress. You can read more about the Acid tests at http://www.acidtests.org/, as well as go to the actual test pages to put your browser through its paces. In addition, if you are writing HTML5 code, you will want to know if your browser supports it and how well it does. A web site that will tell you the level of support for HTML5 from your browser is http://html5test.com. Standards compliance on sites today Are major web sites using web standards, or are they just hacking something together? Let’s take a look at a few different companies out there and see how they score using the W3C’s markup validation service. You’ll be surprised how many large web site don't pass standards validation tests; don’t get disheartened however—there is no reason why you can’t go one better and get your sites validating properly. Bear in mind as you read the below reports that the larger and more complicated a web site is, the harder it is to make it validate, generally speaking (there are other factors to consider, such as the technologies used). Amazon: Shopping with standards? Chances are that if you’ve ever done any online shopping, you’ve probably visited http://www.amazon.com/ (or one of its country-specific web sites). Amazon is a megastore in cyberspace, offering everything from books to CDs to groceries in certain areas. Does Amazon.com validate though? A quick validation of their home page reports 450+ errors and over 160 warnings! Amazon.com fails with flying colors! Not only is there invalid markup, but their declared doctype is HTML 4.01 (ancient by Internet standards). Amazon has a bit of a journey when it comes to standards-compliance. I don’t have the inside track at Amazon, but if I’m allowed to speculate for a minute, I’d say that because Amazon has been around for quite some time, they have probably been using the same software to power their web site for their entire lifespan. Because web standards didn’t really grab the spotlight until early in this millennium, chances are that the system that Amazon uses for selling products online was developed back when web standards weren't really supported or publicized. I don’t know for sure, but I’d guess that Amazon suffers from a case of just sticking with what works for them. CNN: Standardized news? Surely news organizations are semantic beings? http://cnn.com is one of the largest media web sites around. With global resources, reporting on news stories as they happen, surely they’ve got a team of in-house specialists ensuring that their web site is produced with valid markup? CNN.com (as of January 2013) fails validation with over 200 errors. They list an HTML5 doctype, but a lot of their markup looks like it is holdover from HTML4 with presentational elements aplenty. Apple: The pinnacle of elegance in design … and validation? Apple is renowned for their beautiful and functional hardware and software products. Their product announcements are almost like religious experiences for droves of loyal followers. Apple’s web site (http://apple.com) is often acclaimed as being beautifully designed and well organized, but does it validate? Apple.com comes really close to having valid HTML5 markup. With only 2 errors, there’s a mixture of markup “hacks” to make Internet Explorer see the site right and a custom keyword. The Apple web site comes really close to validating. Why the lack of compliant sites? We’re left crying: “Why, why can’t they just validate?” That may be a little dramatic, but it’s at least similar in content to the question running through your mind at this point. Why do so few web sites validate? I’ve talked about a few possible reasons already — things like legacy e-commerce systems or content management systems — but there’s a few other underlying reasons as well. Education Many schools don't stress web standards. The web coding curricula is generally viewed as being below the technical threshold of most computer science programs and above the technical threshold of most MIS/New Media programs. What I'm getting at here is that many educational courses don’t cover this kind of stuff in any great level of detail. I would be willing to wager that if you ask 10 developers who work with web standards where they learned how to use web standards that 9 of them would reply that they are selftaught (the other one won’t answer you because they don't understand the question). The World Wide Web Consortium (W3C), which is the group responsible for developing standards, and the Web Standards Project (WaSP) are taking on this challenge though and are really pushing to have web standards support improve, both from browser manufacturers and from developers. The entire reason this course you’re enrolled in stresses web standards so much is that I'm just trying to get rid of a few more of the reasons (I hesitate to use the word “excuses” here…) why people aren’t adopting web standards. There’s really no excuse for not using them, given the benefits they incur. Business reasons On forums that discuss web standards there is usually an interesting exchange between those who believe that web standards should be used because they make sense (for all of the reasons we’ve previously discussed), and those who just say “so what”. (I'm sorry to admit I have had this discussion with a relative.) The fact of the matter is, web browsers end up handling really bad code. Your pages don't need to validate in order to have them display properly in most of the major browsers. From a business perspective, where time equals money, why bother spending any additional time to get them to validate at all? You can either crank out a mess of code in 30 minutes, or you can spend 30 minutes coding your page in HTML and CSS and an additional 30 minutes making sure that it validates across all browsers. Which choice do you think is easier? A lot of people from my generation (never mind how old I am!) learned to build web sites using tables for layout, and font tags to deal with typography. It can be intimidating to re-learn how to do something when what you’re doing still “works” (still looks fine in most web browsers). Employers generally don’t know the difference; I’ve never once had a manager talk about the quality of my markup during a performance review. So really, where’s the incentive? I’m going to throw in here (you can guess which side I’m usually arguing) that taking the messy-code approach is shortsighted. Based on my experience, doing a re-design of a standards-based web site is much easier than converting a mess of improperly coded pages (I’ve done both). I have yet to hit that utopia promised by HTML/CSS that you will only have to touch the CSS during a re-design, but I’ve come close. Also bear in mind that you will see a lot more web job adverts these days asking for knowledge of web standards than ever before. Summary In this article we’ve talked about the state of web standards adoption today — how to check whether standards are being used properly on a site, how many sites are using web standards properly and the reasons why people don’t adopt standards. As you’ve seen above, the reasons aren’t really that compelling and should be fairly easy to overcome. So what’s an enterprising web developer of the future to do? Do you bother with web standards or do you fire up a graphical editor and do things the "old fashioned way"? Hopefully, you know the right answer to this question!!! This article was originally written by Jonathan Lane (http://dev.opera.com/author/1072078) and published as part of the Opera Web Standards Curriculum (now the W3C Web Standards Curriculum http://www.w3.org/community/webed/wiki/Main_Page#Web_Standards_Curriculum_tab le_of_contents). It has been revised and updated by Blaine Robertson under the Creative Commons Attribution, Non Commercial - Share Alike 2.5 license (http://creativecommons.org/licenses/by-nc-sa/2.5/).