Archive: mothballed errors

These are examples of errors in HTML that used to be treated differently by different browsers, but are all handled the same these days.

Don't take that as a signal that it's OK to have these errors in web pages though...

Structural error: missing > on start tag

<div
<hr>
... content ...
</div>

Most modern browsers tend to react the same: skip the HR and show only the rest of the content of the div. However, until recently, behaviour was more varied.

Browser Result
Firefox 3.0 .. 3.6
SeaMonkey 2.0
Shows hr in the div
Firefox 4 .. 29
SeaMonkey 2.1 .. 2.26
Skips hr, shows only the rest of the content
Chromium 5 .. 6
Midori 0.2
Shows hr in the div
Chromium 10 .. 33
Midori 0.4
Safari 5
Skips hr, shows only the rest of the content
Internet Explorer 7 .. 11 Skips hr, shows only the rest of the content
Opera 9 .. 12 Skips hr, shows only the rest of the content
Konqueror 3 .. 4 Shows hr in the div
Galeon 2.0 Shows hr in the div

Unrecognised tag name with a style (as attribute, or in a stylesheet)

<style> green {color:green} </style>
...
<green style="color:green">this is a green</green>

Browser Result
Firefox 3 .. 30
SeaMonkey 2.0 .. 2.27
Displays text in green
Chromium 6 .. 35
Midori 0.2 .. 0.4
Safari 5
Displays text in green
Internet Explorer 7 .. 8 Displays text in default colour
Internet Explorer 9 .. 11 Displays text in green
Opera 9 .. 12 Displays text in green
Konqueror 3 Displays text in default colour
Konqueror 4 Displays text in green

Table in P

Note: this isn't technically an error, since the p end tag is optional and paragraphs can't contain tables, the p is officially supposed to end on encountering the table.

<p>Before the table
<table><tr><td>in the table</td></tr></table>
after the table

All modern browsers handle this correctly. However, some older browsers, like IE7, did not end the paragraph, but put the table in it instead. So it's best to avoid this situation.

Staggered tag mismatch: span partially in p, partially outside

<p>Before span <span>in span</p> after p</span> and after span.

(In this example, the p is red and the span is underlined, so you can see where each ends.)

Browser Result
Firefox 3 .. 54
SeaMonkey 2.0 .. 2.51
Span ends at </p>
Chromium 5 .. 58
Midori 0.2 .. 0.4
Safari 5
Span ends at </p>
Internet Explorer 7 .. 8 Span ends with </span>, paragraph break in span
Internet Explorer 9 .. 11
Microsoft Edge 14
Span ends at </p>
Opera 9 .. 10 Span ends with </span>, paragraph break in span
Opera 11 .. 12 Span ends at </p>
Konqueror 3 .. 4 Span ends at </p>

Group of radio buttons with more than one checked.

<input type="radio" id="r1" name="group" value="1" checked="checked">
<input type="radio" id="r2" name="group" value="2" checked="checked">
<input type="radio" id="r3" name="group" value="3" checked="checked">

All modern browsers handle this the same: only the last button has a selection mark. But it's best to avoid this situation; there have been browsers in the past, for example Konqueror 3, that showed selection marks on all three buttons.

Note: if none has "checked", one is supposed to be checked automatically, but no browser does this.

Missing end quote after attribute

<div style="color:red>The first div</div>
<div>The second div</div>

Browser Result
Firefox 3.0 .. 3.6
SeaMonkey 2.0
Displays contents normally and applies attribute
Firefox 4 .. 29
SeaMonkey 2.1 .. 2.26
Doesn't display anything (until the next quote)
Chromium 5 .. 33
Midori 0.2 .. 0.4
Safari 5
Doesn't display anything (until the next quote)
Internet Explorer 7 .. 9 Displays text including start tag as if plain text
Internet Explorer 10 .. 11 Doesn't display anything (until the next quote)
Opera 9 Displays text including start tag as if plain text
Opera 10 .. 12 Doesn't display anything (until the next quote)
Konqueror 3 .. 4 Doesn't display anything (until the next quote)

Text in a list between two list items

<ul>
<li>The first list item</li>
The text in between
<li>The second list item</li>
</ul>

These days, all browsers act the same: display the text between the li elements. But IE7 seems to ignore all </li> end tags, and it puts the text to the end of the first li (on the same line).

Empty width attribute

<img src="pic.gif" alt="" width="">

BrowserResult
Internet Explorer 7 .. 10 Treats image as if width = "1"
All other browsers tested, including IE11 Ignores width, displays image normally

Bad link, variant 2: bad file type for the css

<link rel="stylesheet" href="error-19c-css.txt" type="text/css">

BrowserResult
Firefox 3 .. 55
SeaMonkey 2.0 .. 2.52
Doesn't use stylesheet
Chromium 6 .. 58
Midori 0.2 .. 0.4
Safari 5
Doesn't use stylesheet
Internet Explorer 7 .. 8 Ignores type, shows style normally
Internet Explorer 9 .. 11
Microsoft Edge 14
Doesn't use stylesheet
Opera 9 .. 11 Ignores type, shows style normally
Opera 12 Doesn't use stylesheet
Konqueror 3 Ignores type, shows style normally
Konqueror 4 Doesn't use stylesheet

Of the browsers that don't use the stylesheet, surprisingly they all do use it in quirks mode.

Bad link 3: encoding mismatch

<link rel="stylesheet" href="error-19d-css16.css" type="text/css">

If the HTML file is encoded as UTF-8, and the CSS file is UTF-16, and the link doesn't explicitly specify an encoding, this happens:

BrowserResult
Firefox 3 .. 55
SeaMonkey 2.0 .. 2.52
Doesn't use stylesheet
Chromium 6 .. 59
Midori 0.2 .. 0.4
Safari 5
Doesn't use stylesheet
Internet Explorer 7 .. 11
Microsoft Edge 14
Doesn't use stylesheet
Opera 9 .. 12 Detects encoding, shows style normally
Konqueror 4 Doesn't use stylesheet

Font names with quotes, without quotes

If you have a font name that contains a quote, or an apostrophe, you have to be extra careful how to use it.

<div style="font:2em It wasn't me">font:2em It wasn't me</div>
<div style="font:2em It\ wasn't\ me">font:2em It\ wasn't\ me</div>
<div style="font:2em 'It wasn\'t me'">font:2em 'It wasn\'t me'</div>

(And yes, this is a real font; it's in the Linux repositories.)

Modern browsers all consider the last one OK, but not the first two.

BrowserIt wasn't meIt\ wasn't\ me'It wasn\'t me'
Firefox 3 .. 3.6 Not OKNot OKNot OK
Chromium 6 .. 15 Not OKNot OKOK
Internet Explorer 7 OKNot OKNot OK
Opera 9 .. 10 OKOKOK

<![CDATA[ sections in HTML

<div>CDATA sections in HTML are <![CDATA[not]]> invisible.</div>

In modern browsers, the CDATA section is not shown.

Browser Result
Firefox 3 .. 30
SeaMonkey 2.0 .. 2.27
Does not show the CDATA section
Chromium 6 .. 35
Midori 0.2 .. 0.4
Safari 5
Does not show the CDATA section
Internet Explorer 7 .. 11 Does not show the CDATA section
Opera 10 .. 11 Shows the contents of the CDATA section
Konqueror 3 .. 4 Does not show the CDATA section

getElementById without ID

<a name="lime">A lime a</a>
<script type="text/javascript">
document.getElementById('lime').style.backgroundColor = 'lime';
</script>

The <a> does not have an ID, so its background colour is not changed in modern browsers.

Browser Result
Firefox 3 .. 30
SeaMonkey 2.0 .. 2.27
Does not change the background
Chromium 6 .. 35
Midori 0.2 .. 0.4
Safari 5
Does not change the background
Internet Explorer 5 .. 7 Uses the name attribute for the ID and changes the background to lime
Opera 10 .. 11 Does not change the background
Konqueror 3 .. 4 Does not change the background

Bad value for align attribute

<table>
<caption align="none">This is the caption</caption>
<tr><td>and this is the content.</td></tr>
</table>

BrowserResult
Opera 9 .. 12 Takes the opportunity to put the caption below the table
All other browsers tested so far Ignores the bad value

Note: as align is deprecated, this test was done using HTML 4.01 Transitional.

With XHTML: ID in the XML namespace

All elements and attributes are normally taken from the HTML namespace, but it's possible to use other namespaces by using a prefix. So in this example, the id on the bottom div is in the XML namespace; it won't have any effect on how the div is handled.

<style type="text/css"> #theID {color:green} </style>
.
.
<div id="theID">This is a div with an ID</div>
<div xml:id="theID">This is a div with an xml:ID</div>

(Live example)

Most browsers ignore the id in the bottom div and won't give it the style. Except Opera v12 and below, which will.

It has come to my attention however, that xml:id does not exists in the formal recommendations; that it was only part of a proposal in the past. So apparently, Opera already anticipated the future, but it never materialized.