Browser bugs I’ve found

A list and links to test cases of browser bugs I’ve come across. If there are any work arounds they are indicted. I expect this list to grow, but, since so many people are ahead of me on this there might not be that many left to find.

Bugs in multiple browsers

Browsers don’t implement font-weight consistently. The font-weight property in css specifies numeric values as well as keywords. Until recently browsers did not do much with the numeric values. I’ve created a test case.

It is important to note for this to work you need a font with all the appropriate weights. I don’t have one but Helvetica neue comes close which is the one being used here.

Browser Font weight numeric values1 Keyword Lighter Bolder
Firefox 3yesyesyesyes3
Opera 9noyesyes2yes
Safari 3noyesyes2yes
Safari 4βyesyesyesyes3
ie 6noyesyes2no
ie 7noyesyes2no
ie 8noyesyes2no
  1. Instead of implementing multiple weights the numeric values are mapped 100–500 same as normal; 600–900 same as bold.

  2. Works on bold content which becomes normal but when applied to normal text does not become lighter.

  3. When applying bolder to font-weight: 300 it remains light instead of being set to normal (is this a bug?).

Styling tables

Browsers style tables poorly. Browser support for multiple css properties relating to tables — most notably the col, colgroup and the tr elements — is poor.

The table lists browses and properties. The row headings link to the test case for that property. Where a browser rendering is incorrect notes are after the table.

Css poperty Firefox 2 & 3 Opera 9 Safari 2 Safari 3 ie 6 ie 7 ie 8
border on colgroup & col yes buggy1 buggy2 yes no no yes
border on tr yes yes yes yes no no yes
border on tbody yes yes buggy3 yes no no yes
border on thead & tfoot yes yes yes yes no no yes
border-style: hidden on tr yes yes yes yes no no buggy6
border-style: hidden on colgroup yes yes yes yes no no buggy6
border-style: hidden on td yes yes yes yes no no yes
visibility: collapse on td & th yes yes yes yes no no yes
visibility: collapse on tr yes buggy4 buggy4 buggy4 no no yes
visibility: collapse on colgroup buggy5 buggy5 no no no no yes
visibility: collapse on col buggy5 buggy5 no no no no no

Notes — I have not included properties that work in all the browsers tested so, background-color, color, borders on the td element and padding, since these all seem to work reliably.

  1. Opera incorrectly places borders separating the thead and tbody sections.

  2. Safari incorrectly places borders separating the thead and tbody sections it also draws a border around every column contained in the colgroup not just the colgroup.

  3. Safari incorrectly places a border below the tfoot element.

  4. The table row should not be rendered, subsequent rows should move up to fill the space as though the row is not there.

  5. The table column should not be rendered, subsequent columns should move over to fill the space as though the column is not there.

  6. Horizontal borders-are hidden correctly. Vertical borders are not

Outline property the affecting layout — Firefox 1.5, 2.0, 3 and Opera 90.1 (fixed in opera 9.5) allow the outline property to affect the layout of blocks. Accourding to the ccs 2.1 spec the outline property should have no affect on layout. In Firefox 1.5 and Opera 9.1 this is not so. In both if the containing element is set to overflow: auto then the outline is taken into account when positioning the block, while in Opera it affects the calculated width of the block but not its position.

The test case demonstrates the bug, there should be no scroll bars and no red should be visible.

Simple test case.

Styling legend tags

Recently I was trying to position legend tags and got nowhere — so I’ve put together a small grid of what works and what doesn’t. To be honest not a lot does, see the table below. I have also made a few test cases and notes.

Browserposition:setfloat:
absolute relativefixedmargins *widthleftright
Firefox 1.5, 2.0 & 3nononoyesnonono
Opera 8.5buggyyesbuggynonoyesyes
Opera 9yesyesyesyesyesyesyes
Safari 2.03 & 3yesyesyesbuggy**yesyesyes
ie 8β2yesyesyes††yesyesyesyes
ie 7buggybuggyyesbuggybuggyyesyes
ie 6buggybuggynobuggynoyesyes
ie 5.5buggybuggynobuggynoyesyes

General notes on the table — styling the legend tag is at best hit and miss, Safari seems to do the best job of it, while Firefox seems not to even try. Interestingly Firefox 1 seemed to do more than Firefox 1.5, although I didn’t add it to the table since it is no longer current.

Firefox

When applying styles using :first-line and :first-letter and using classes applied using javascript’s className method the styles are not applied.

A test case which illustrates the bug using the following code:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
  <head>
    <meta http-equiv="content-type" 
		content="text/html; charset=utf-8">
	  <title>Test case for applying styles with
		pseudo elements</title>
      <style type="text/css">
	    p
		  {
		    width: 300px
		  }
        p.test:first-letter
		  {
            color: green
		  }
        p.test1:first-line
		  {
			color: green
		  }

	</style>

	<script type="text/javascript">
		function dropCap()  {
                
    document.getElementsByTagName('p')[0].className='test';
    document.getElementsByTagName('p')[1].className='test1';
		}
	</script>
</head>
<body>
  <p>When you click the link the first letter should 

become Green</p>	
  <p>When you click the link the first line of this paragraph
        should become green.</p>
  <p><a href="#" onclick="dropCap();return false">Apply 
         the style</a></p>

  </body>
</html>

overflow: auto on list items (fixed in Firefox 1.5). When an li element is set to overflow: auto Firefox creates a horizontal scroll bar in most cases. Short entries not containing block level tags don’t suffer from this problem

Simple test case.

The work around is to wrap the content of a list item in a div and set the overflow on the div instead.

Internet Explorer

IE 5.5 and 6 Incorrectly sets the left origin of the positioning coordinates to the edge of the content of the first element of the containing block, instead of the edge of the relatively positioned containing block.

This occurs whether the preceding element has its left margin or left padding set. Strangely ie behaves correctly if the position is set relative to the right edge. It also behaves correctly if the containing block is positioned absolutely

I think the bug is explained by On having layout in the section Containing block, what containing block?

Simple test case.

IE 5, 5.5, 6 and 7 move an unfloated element to the position as though they had been floated. This only affects the element immediately following the float.

Simple test case.

Incorrect positions when using right and bottom IE 5, 5.5 and 6. If the height of a relatively positioned block is an an even number or the width an odd number, any element that’s positioned absolutely inside that block and use bottom or right will be 1px out. They will be either 1px too high or 1px to the left of their correct position. This depends on the width or height of the containing block. If both occur the positioned element will be incorrectly positioned on both axes.

Simple test case and an unstyled version for those with standards compliant browsers so you can read the explanation.

Opera

Containing floats inside overflow:auto (fixed in Opera 8). When a block set to, overflow: auto, contains floats Opera does not contain the floats correctly. See Super simple clearing floats at Anne’s Weblog for an explanation of why this is useful and see css 2 spec as to why it should work.

Simple test case.

Opera not recognising &rsquo; and &lsquo; (fixed in Opera 8). When using a xhtml doc type Opera does not display anything. The numeric references &#8216; and &#8217; work fine.

Safari

Safari defaults span attribute to 0 (fixed in Safari 3). When the colgroup element does not have any child col elements and the span attribute is not set Safari defaults the value to 0. The span attribute should default to 1.

Simple test case.

Safari crashes when the hover pseudo-class is used to generate content (fixed as of at least version 2.0.4 (419.3)). In an experiment with generated content, I discovered that attempting to use position: absolute will crash Safari when the user hovers over the element.

Since css 2 does not really cover positioning generated content this technique is of limited use, but it does work in Opera.

Simple test case.