All about internet-related coding standards, why web site owners should care, and their effects on a web site’s usability, execution speed in the browser, and cost of maintenance and development. Includes links to key resources.
- Code style guides:
- HTML5 coding style guide and conventions — W3 Schools
- HTML & CSS coding standards
- Intro to web programming languages
- HTML 5.1 Standard
- CSS 2.1 Specification
- PHP documentation — PHP.net
Web programming languages — W3C
Web programming languages — other
These languages are the triumvirate of most “front end” web development. They are used by developers to encode how a site visitor sees the site’s content, form and certain functions. They are not the only such tools but they are the most common ones that provide the essentials. (“Back end” languages might run on the web server, and may include PHP, SQL, Ruby and others; in general, they are not as concerned about how a site looks as they are with what will be displayed.)
These languages have evolved along with the internet itself. For example, CSS has supplanted code-heavy HTML techniques once commonly used to define web pages’ layout. By thus shifting layout duties to CSS, HTML has been refocused on what it was made for, tagging content with succinct codes that identify text as, for example, a paragraph, a heading or a path to an image. There are some default settings but HTML doesn’t really determine with any specificity what things look like or where they belong on the web page. CSS does that. This has resulted in greater separation of content from markup code, and typically makes a web site’s development and maintenance more efficient, more easily maintained and more affordable.
What is CSS? “Cascading Stylesheets”
Cascading stylesheets (CSS) faced initial, but short-lived, resistance from web developers and site owners because of poor support for it in the web browsers of the time. Today, common web browsers comply to a great extent with official CSS specifications, and CSS now commonly is used to define the visual style and presentation of web documents. For many web sites, the adoption of CSS lightened the byte-load (of pages we sampled) by from one-third to one-half. It also, largely, separates formatting markup from content, making maintenance simpler and allowing more-elegant solutions when using content-management systems (CMS). The first standard for CSS was formalized as a W3C recommendation in 1996.
Generally, HTML with CSS offers a streamlined alternative to older, code-heavy methods of implementing web designs. In general, a site employing CSS:
- requires less code, downloads faster
- may render faster in the browser
- simplifies updates and maintaintenance of site content and code
- adapts more easily for display on mobile devices and other display sizes, and for print
Change and evolution proceed. Not all browsers implement the HTML and CSS standards perfectly, but all major modern browsers offer strong support for them. Elements of HTML 5 and CSS 3 are being adopted more thoroughly by browser manufacturers, but new capabilities require time before they can be relied upon. Some inconsistencies remain in browsers’ intrepretions of the standards but, usually, workarounds can be found or else the differences are negligible in all but the most pixel-perfect, demanding cases. (See our “browser stress test” on this page. It is one example that, using standard-but-cutting-edge code, displays a result that varies depending on how up-to-date the user’s browser is with respect to certain HTML 5 and CSS 3 attributes.)
Older Web Browsers: From Graceful Degradation to Progressive Enhancement to Responsive Designs
Certain web sites may be mandated or find it cost-effective (due to ROI) to support very old web browsers that have not adopted modern standards. Site owners should be aware there are real and reasonable costs associated with making a web site perform for very outdated browsers. In order to render today’s web content correctly, older browsers are more likely to need workarounds or even reversion to an older, verbose coding style in order to achieve a look and feel equivalent to that displayed by standards-compliant browsers. This may add to initial development costs, increase maintenance time and contribute other side effects that should be evaluated when making the business decision whether to support older browsers.
It is considered poor practice to deploy code intended to work correctly only in particular browsers.1 A user’s choice of web browser (or of assistive device, for visually impaired users) is to be left solely to the discretion, preference and needs of the end user. And despite any eagerness to embrace new standards, developers mustn’t consign users of yesterday’s browsers to a less-than-functional or challenged shadow of the intended user experience.
1. Exceptions include institutional and dedicated systems where the supported hardware and software may be controlled or mandated. Even there, however, federal workplace regulations might require that users of assistive devices have equal access to everything that is available to users of the mandated browser, without hindrance. Organizations deciding whether to mandate use of a specific browser by its employees, or by other users, may wish to refer to USA federal guidelines and/or seek legal counsel about their obligations, if any, to support other browsers and devices.
HTML and XHTML — Web Development Coding Standards
Adhering to web coding standards makes cross-browser incompatibilities less likely during development and makes many projects easier to deliver on time. It also increases a site’s likelihood of seamless transition as future browser versions are released.
But standards have a measurable effect on users that goes beyond technical purity and administrative convenience. A web browser can render standard code efficiently and usually quickly. But non-standard code on a web page triggers a web browser’s so-called quirks mode, in which it goes to more-laborious lengths to interpret a page’s intended appearance. That slows the browser and can make a web page feel noticeably sluggish to the user, depending on many factors.
In general, we currently recommend adhering to the XHTML 1.0 and/or HTML 5 coding standards. Used with CSS, this can allow a web page to be designed for platforms as different as desktop displays, smartphones and other mobile devices, dashboard instruments and specialized browser clients for the visually and physically challenged. The (X)HTML code says, “This is a paragraph” and the CSS says, “A paragraph looks like this” in print, on the screen, on mobile devices of various sorts. As a very minor example, certain elements of this site do not display when printed because we decided they are irrelevant in print.
To Validate or Not To Validate?
Online validators provided by the W3C, and perhaps other validation services, make it easier to know if a web resource conforms to one of the standards. Is it necessary to validate your site’s code? In general, no. Is it a good idea? Usually. Canny developers will use validators intelligently and, if it is appropriate, acceptable and necessary, may publish a well-tested web page whose code does not pass validation. They should, however, be aware of the tradeoffs and act thoughtfully.
Techniques intended to coerce validation of non-standard code should be mistrusted and usually avoided. Forced validation might fool the validator, or one’s manager, but the code might still trigger a browser’s quirks mode, or worse.
In a Perfect World
We prefer to keep the sites we produce free of workarounds that address obscure rendering issues in specific browsers. But even some major browsers have CSS bugs, or deficiencies, and some businesses must support users of browsers that were developed before today’s standards were published. We assess each client’s audience and needs when planning our code approach. We take the time to understand the business at hand and adopt appropriate approaches most likely to ensure a smooth development process and a reliable, effective result.
External Design’s Approach
Our work focuses on achieving good results for each client’s web projects, across various computers, web browsers, smartphones, and other devices. We may consult with clients’ analytics, if any, on how backward-compatible their sites should be to serve their purposes.