Year round learning for product, design and engineering professionals

Markup

The heart of any web site or application is its markup, and at the forefront of the movement toward a standards based web has been promoting a number of practices in markup. These include

  • the use of valid HTML or XHTML
  • the use of appropriate semantic markup
  • avoiding the use of presentational markup

In this section we asked several questions to attempt to get a better understanding of common current practice in relation to this area of web design and development.

Given that this survey asked developers what their practices are, there’s the chance that they’ll provide answers about what they think they should be doing, rather than what they actually are doing, even though it is an anonymous survey. Verifying how closely the responses match the actual practices by developers would in any case be difficult.

What versions of HTML/XHTML do respondents use?

In terms of markup languages, 6% of respondents use HTML exclusively, while 42% use XHTML exclusively. A further 16% use predominantly HTML, while 30% use predominantly XHTML – making an overwhelming ratio of around 4:1 XHTML to HTML use by respondents. This is surprisingly high, given the debates which still take place about the benefits or otherwise of XHTML over HTML. At the very least this indicates that developers feel they should on the whole be using XHTML. The implications for HTML5’s goal of having both HTML and XHTML versions of that language are interesting. If a significant majority of the respondents to this survey, who are much more likely to be early adopters of HTML5 are focussing their efforts on XHTML, is there sufficient benefit for the effort of maintaining both HTML and XHTML versions of HTML5?

Interestingly, while there have been a small number of high profile uses of HTML5 to date, only one of all the respondents made reference to using HTML5 – replying they use

Mostly XHTML, sometimes a subset of HTML5

Although, in a later question regarding doctypes, 1.3% of respondents say they declare a HTML5 doctype.

Which type of markup do you use?
Answer Count Percentage
Exclusively HTML 73 5.92%
Exclusively XHTML 523 42.38%
Mostly HTML, sometimes XHTML 196 15.88%
Mostly XHTML, sometimes HTML 367 29.74%
XML 9 0.73%
Other 10 0.81%
No answer 11 0.89%
Non completed 45 3.65%

markup language use

How often do respondents validate their markup

Time and again objective studies of real world web sites finds that only a minority validate, and that in many cases, the failure to validate is not trivial. In this survey, we asked developers not whether they validate, but how often. Only 3% replied never, while 37% replied always, 33% frequently, and 22% sometimes. This indicates at least that respondents understand the importance of validating.

How often do you validate your markup?
Answer Count Percentage
Always 454 36.79%
Frequently 401 32.50%
Sometimes 278 22.53%
Never 41 3.32%
No answer 15 1.22%
Non completed 45 3.65%

validation frequency

What doctypes do respondents declare?

An important aspect of current best practice is the declaration of a doctype to indicate which version of HTML or XHTML the web site uses.

Less than 2% of respondents indicated they don’t use doctypes, with XHTML 1.01 transitional being the most declared at 34%, closely followed by XHTML 1.1 Strict at 31%.

Despite the answer to the previous question, 1.3% of respondents (16 in total) declare the HTML5 doctype – making the use of this doctype nearly as common as the use of no doctype at all.

It’s interesting but perhaps not surprising to see the use of frames almost non-existent, with about 1/3 of 1% of respondents declaring a frameset declaration.

Also interesting to see that 4.3% of all respondents declare XHTML 1.1 doctypes.

Once again, it must be emphasized that the profile of our respondents would not match that of the “typical” web professional, but it is instructive that these early adopters are definitely well on the way to using strict versions of XHTML for their markup. Strict versions of these languages essentially avoid any presentational elements and attributes of the languages.

For a comparison with real world results, Opera’s MAMA project found 61% of doctypes were some form of HTML4, 33% XHTML 1.0 and only 1.2% XHTML 1.1. Around 3.5% were frameset (as opposed to .3%), 6% strict (40%), and 83% transitional (45%).

Which doctype do you typically declare for your pages?
Answer Count Percentage
none 21 1.70%
HTML 4.01 strict 106 8.59%
HTML 4.01 transitional 142 11.51%
HTML 4.01 frameset 3 0.24%
XHTML 1.01 strict 384 31.12%
XHTML 1.01 transitional 425 34.44%
XHTML 1.01 frameset 1 0.08%
XHTML 1.1 53 4.29%
HTML 5 16 1.30%
Other 10 0.81%
No answer 28 2.27%
Non completed 45 3.65%

DTDs declared

Tables finally out the window?

While it’s still the cause of some lingering controversy, one of the trends of the last decade, accelerating in the last few years, has been the erosion of the use of the table element for page layout. While 85% of respondents answer “no” as to whether they use tables for page layout, over 10% of even the kind of respondents to this survey continue to use table based layouts, despite the widespread belief that avoiding such layouts is current best practice.

Do you use tables for layout?
Answer Count Percentage
No 1046 84.76%
Yes 127 10.29%
No answer 16 1.30%
Non completed 45 3.65%

Presentational HTML

In a related question, only 30% of respondents replied that they used no presentational HTML. The width and height attributes at 23% and 19% are still the most widely used presentational HTML – a throwback to the days of slower networks and browsers when adding these attributes to image elements helped browsers layout pages before images had been downloaded and their dimensions could be calculated. The border attribute is also still widely used – most likely for images inside link elements. By default in earlier browsers images inside links were styled with a blue border that was most commonly supressed using the border attribute. 10% of developers still use the center element, reflecting perhaps some ongoing confusion about the ways in which CSS can be used to center text (text-align: center), or blocks inside their parent elements (left and right margins of “auto”).

It’s both gratifying, but still a little concerning that nearly 6% of respondents use the font element, and 18% and 15% of respondents respectively still use the b and i elements.

So, it’s clear that presentational HTML is on the wane, but with up to nearly quarter of respondents using some form of presentational HTML, we’ll be seeing it’s use for some time yet it would appear.

If you use any of the following HTML tags or properties, please mark them:
Answer Count Percentage
None 378 30.63%
font 70 5.67%
b 218 17.67%
i 187 15.15%
border 146 11.83%
width 284 23.01%
u 79 6.40%
height 238 19.29%
cellspacing 243 19.69%
cellpadding 209 16.94%
center 122 9.89%

Extended Semantics

The last two questions in this section aimed to see the extent to which respondents are using “semantic” technologies such as microformats and RDFa in their markup.

Microformats have been around in one form or another since 2003, and build on underlying ideas and practices in markup which go back quite a bit further. RDFa is a much more recent technology. Microformats and RDFa differ in a number of important ways, not least that while RDFa is a W3C “standard”, microformats work entirely within the framework of existing HTML standards, and are developed outside the auspices of a recognized organization like the IETF or W3C.

Over a third of respondents answered that they do use microformats in their markup – a surprisingly high number for even such a sample as this. A little under 20% answered “what are microformats”, giving around 80% awareness of the technology.

Not surprisingly, only about a tenth as many respondents answered that they use RDFa (3.4%), and nearly half (44%) that they didn’t know what RDFa is.

After several years of advocacy and development by a reasonably small but diligent and high profile community, microformats seem to be established among early adopters. While it is early days, RDFa will require it would seem, a similar community and effort to become equally established.

Do you use microformats in your markup?
Answer Count Percentage
Yes 429 34.76%
No 512 41.49%
What are microformats? 231 18.72%
No answer 17 1.38%
Non completed 45 3.65%
Do you use RDFa in your markup?
Answer Count Percentage
Yes 42 3.40%
No 586 47.49%
What’s RDFa? 544 44.08%
No answer 17 1.38%
Non completed 45 3.65%

Next

Next, we’ll see how respondents are using CSS and other presentational technologies.

delivering year round learning for front end and full stack professionals

Learn more about us

Web Directions South is the must-attend event of the year for anyone serious about web development

Phil Whitehouse General Manager, DT Sydney