Markup

The heart of any web site or appli­ca­tion is its markup, and at the fore­front of the move­ment toward a stan­dards based web has been pro­mot­ing a num­ber of prac­tices in markup. These include

  • the use of valid HTML or XHTML
  • the use of appro­pri­ate seman­tic markup
  • avoid­ing the use of pre­sen­ta­tional markup

In this sec­tion we asked sev­eral ques­tions to attempt to get a bet­ter under­stand­ing of com­mon cur­rent prac­tice in rela­tion to this area of web design and development.

Given that this sur­vey asked devel­op­ers what their prac­tices are, there’s the chance that they’ll pro­vide answers about what they think they should be doing, rather than what they actu­ally are doing, even though it is an anony­mous sur­vey. Verifying how closely the responses match the actual prac­tices by devel­op­ers would in any case be difficult.

What ver­sions of HTML/​XHTML do respon­dents use?

In terms of markup lan­guages, 6% of respon­dents use HTML exclu­sively, while 42% use XHTML exclu­sively. A fur­ther 16% use pre­dom­i­nantly HTML, while 30% use pre­dom­i­nantly XHTML — mak­ing an over­whelm­ing ratio of around 4:1 XHTML to HTML use by respon­dents. This is sur­pris­ingly high, given the debates which still take place about the ben­e­fits or oth­er­wise of XHTML over HTML. At the very least this indi­cates that devel­op­ers feel they should on the whole be using XHTML. The impli­ca­tions for HTML5’s goal of hav­ing both HTML and XHTML ver­sions of that lan­guage are inter­est­ing. If a sig­nif­i­cant major­ity of the respon­dents to this sur­vey, who are much more likely to be early adopters of HTML5 are focussing their efforts on XHTML, is there suf­fi­cient ben­e­fit for the effort of main­tain­ing both HTML and XHTML ver­sions of HTML5?

Interestingly, while there have been a small num­ber of high pro­file uses of HTML5 to date, only one of all the respon­dents made ref­er­ence to using HTML5 —  reply­ing they use

Mostly XHTML, some­times a sub­set of HTML5

Although, in a later ques­tion regard­ing doc­types, 1.3% of respon­dents say they declare a HTML5 doctype.

Which type of markup do you use?
AnswerCountPercentage
Exclusively HTML735.92%
Exclusively XHTML52342.38%
Mostly HTML, some­times XHTML19615.88%
Mostly XHTML, some­times HTML36729.74%
XML90.73%
Other100.81%
No answer110.89%
Non com­pleted453.65%

markup language use

How often do respon­dents val­i­date their markup

Time and again objec­tive stud­ies of real world web sites finds that only a minor­ity val­i­date, and that in many cases, the fail­ure to val­i­date is not triv­ial. In this sur­vey, we asked devel­op­ers not whether they val­i­date, but how often. Only 3% replied never, while 37% replied always, 33% fre­quently, and 22% some­times. This indi­cates at least that respon­dents under­stand the impor­tance of validating.

How often do you val­i­date your markup?
AnswerCountPercentage
Always45436.79%
Frequently40132.50%
Sometimes27822.53%
Never413.32%
No answer151.22%
Non com­pleted453.65%

validation frequency

What doc­types do respon­dents declare?

An impor­tant aspect of cur­rent best prac­tice is the dec­la­ra­tion of a doc­type to indi­cate which ver­sion of HTML or XHTML the web site uses.

Less than 2% of respon­dents indi­cated they don’t use doc­types, with XHTML 1.01 tran­si­tional being the most declared at 34%, closely fol­lowed by XHTML 1.1 Strict at 31%.

Despite the answer to the pre­vi­ous ques­tion, 1.3% of respon­dents (16 in total) declare the HTML5 doc­type — mak­ing the use of this doc­type nearly as com­mon as the use of no doc­type at all.

It’s inter­est­ing but per­haps not sur­pris­ing to see the use of frames almost non-​​existent, with about 1/​3 of 1% of respon­dents declar­ing a frame­set declaration.

Also inter­est­ing to see that 4.3% of all respon­dents declare XHTML 1.1 doctypes.

Once again, it must be empha­sized that the pro­file of our respon­dents would not match that of the “typ­i­cal” web pro­fes­sional, but it is instruc­tive that these early adopters are def­i­nitely well on the way to using strict ver­sions of XHTML for their markup. Strict ver­sions of these lan­guages essen­tially avoid any pre­sen­ta­tional ele­ments and attrib­utes of the languages.

For a com­par­i­son with real world results, Opera’s MAMA project found 61% of doc­types were some form of HTML4, 33% XHTML 1.0 and only 1.2% XHTML 1.1. Around 3.5% were frame­set (as opposed to .3%), 6% strict (40%), and 83% tran­si­tional (45%).

Which doc­type do you typ­i­cally declare for your pages?
AnswerCountPercentage
none211.70%
HTML 4.01 strict1068.59%
HTML 4.01 transitional14211.51%
HTML 4.01 frameset30.24%
XHTML 1.01 strict38431.12%
XHTML 1.01 transitional42534.44%
XHTML 1.01 frameset10.08%
XHTML 1.1534.29%
HTML 5161.30%
Other100.81%
No answer282.27%
Non com­pleted453.65%

DTDs declared

Tables finally out the window?

While it’s still the cause of some lin­ger­ing con­tro­versy, one of the trends of the last decade, accel­er­at­ing in the last few years, has been the ero­sion of the use of the table ele­ment for page lay­out. While 85% of respon­dents answer “no” as to whether they use tables for page lay­out, over 10% of even the kind of respon­dents to this sur­vey con­tinue to use table based lay­outs, despite the wide­spread belief that avoid­ing such lay­outs is cur­rent best practice.

Do you use tables for layout?
AnswerCountPercentage
No104684.76%
Yes12710.29%
No answer161.30%
Non com­pleted453.65%

Presentational HTML

In a related ques­tion, only 30% of respon­dents replied that they used no pre­sen­ta­tional HTML. The width and height attrib­utes at 23% and 19% are still the most widely used pre­sen­ta­tional HTML — a throw­back to the days of slower net­works and browsers when adding these attrib­utes to image ele­ments helped browsers lay­out pages before images had been down­loaded and their dimen­sions could be cal­cu­lated. The bor­der attribute is also still widely used — most likely for images inside link ele­ments. By default in ear­lier browsers images inside links were styled with a blue bor­der that was most com­monly supressed using the bor­der attribute. 10% of devel­op­ers still use the cen­ter ele­ment, reflect­ing per­haps some ongo­ing con­fu­sion about the ways in which CSS can be used to cen­ter text (text-​​align: cen­ter), or blocks inside their par­ent ele­ments (left and right mar­gins of “auto”).

It’s both grat­i­fy­ing, but still a lit­tle con­cern­ing that nearly 6% of respon­dents use the font ele­ment, and 18% and 15% of respon­dents respec­tively still use the b and i elements.

So, it’s clear that pre­sen­ta­tional HTML is on the wane, but with up to nearly quar­ter of respon­dents using some form of pre­sen­ta­tional HTML, we’ll be see­ing it’s use for some time yet it would appear.

If you use any of the fol­low­ing HTML tags or prop­er­ties, please mark them:
AnswerCountPercentage
None37830.63%
font705.67%
b21817.67%
i18715.15%
bor­der14611.83%
width28423.01%
u796.40%
height23819.29%
cellspac­ing24319.69%
cell­padding20916.94%
cen­ter1229.89%

Extended Semantics

The last two ques­tions in this sec­tion aimed to see the extent to which respon­dents are using “seman­tic” tech­nolo­gies such as micro­for­mats and RDFa in their markup.

Microformats have been around in one form or another since 2003, and build on under­ly­ing ideas and prac­tices in markup which go back quite a bit fur­ther. RDFa is a much more recent tech­nol­ogy. Microformats and RDFa dif­fer in a num­ber of impor­tant ways, not least that while RDFa is a W3C “stan­dard”, micro­for­mats work entirely within the frame­work of exist­ing HTML stan­dards, and are devel­oped out­side the aus­pices of a rec­og­nized orga­ni­za­tion like the IETF or W3C.

Over a third of respon­dents answered that they do use micro­for­mats in their markup — a sur­pris­ingly high num­ber for even such a sam­ple as this. A lit­tle under 20% answered “what are micro­for­mats”, giv­ing around 80% aware­ness of the technology.

Not sur­pris­ingly, only about a tenth as many respon­dents answered that they use RDFa (3.4%), and nearly half (44%) that they didn’t know what RDFa is.

After sev­eral years of advo­cacy and devel­op­ment by a rea­son­ably small but dili­gent and high pro­file com­mu­nity, micro­for­mats seem to be estab­lished among early adopters. While it is early days, RDFa will require it would seem, a sim­i­lar com­mu­nity and effort to become equally established.

Do you use micro­for­mats in your markup?
AnswerCountPercentage
Yes42934.76%
No51241.49%
What are microformats?23118.72%
No answer171.38%
Non com­pleted453.65%
Do you use RDFa in your markup?
AnswerCountPercentage
Yes423.40%
No58647.49%
What’s RDFa?54444.08%
No answer171.38%
Non com­pleted453.65%

Next

Next, we’ll see how respon­dents are using CSS and other pre­sen­ta­tional tech­nolo­gies.