SoLoGHoST
SoLoGHoST

Reputation: 2689

Colspans in Opera Browsers not working right

I can't understand the problem here but this looks fine in all browsers cept Opera.

The HTML Code is as follows:

<table width="395" height="214" border="1">
  <tr>
    <td colspan="2">Here is some content in here that has 2 colspans</td>
    <td width="137">This only has 1 colspan.</td>
  </tr>
  <tr>
    <td width="113">This has only 1 colspan also.</td>
    <td colspan="2">This cell has 2 colspans now and should look presentable hopefully.</td>
  </tr>
  <tr>
    <td colspan="3">This cell has 3 colspans within this table and should fill up the entire width of the table.</td>
  </tr>
</table>

Now the Output looks like this in Opera:

alt text

But how do I make it look like this (as all other browsers look like): alt text

The problem is actually much deeper than this, but this is the main basic overall problem.

Upvotes: 1

Views: 454

Answers (3)

Kristof Neirynck
Kristof Neirynck

Reputation: 4162

This bug exists in Opera 9, 10, 11 and 12.

Opera counts the number of columns as the maximum number of <td> or <th> tags in a row. This means you always need one row with all tds having no colspan attribute or the colspan attribute set to 1. Adding table-layout: fixed to the table style seems to help as well.

This bug is fixed since Opera switched from the Presto to the Blink rendering engine in 2013.

http://www.crydust.be/test/opera_table_colspan_bug/

Upvotes: 1

hallvors
hallvors

Reputation: 6239

Seems like a bug :-/ I've found your bug report, thanks. I guess you need a hack where you add one row that has the total expected number of cells and style it to be invisible.. :-(

Upvotes: 0

meder omuraliev
meder omuraliev

Reputation: 186742

I would try giving explicit css classes with explicit widths to every td.

<td class="foo">

.foo { width:200px; }.

Make sure the math adds up properly.

Upvotes: 1

Related Questions