Table problems with WebKit

I am having trouble getting this code to display correctly in WebKit (chrome / safari) browsers. It looks great in IE6, IE7 and FireFox.

<table width="100%">
    <tr>
        <td rowspan="2" style="vertical-align:middle;">
            <a href="http://http://{$smarty.const.DOMAIN}/company/a_cherry_on_top/line/gift_cards/?v=s2"><img src="/i/thumbnails/acotgc25sm.gif" alt="Gift Certificate"/></a>
        </td>

        <td style="vertical-align:middle;">
            <a href="http://{$smarty.const.DOMAIN}/article?a=2044" target="_top">Wishlist</a>
        </td>
        <td style="vertical-align:middle;">
            <a href="http://{$smarty.const.DOMAIN}/article?a=2125" target="_top">Link to Us</a>
        </td>
        <td style="vertical-align:middle;">
            <a href="http://www.shareasale.com/shareasale.cfm?merchantID=8362" target="_blank">Affiliate Program</a>
        </td>
        <td style="vertical-align:middle;">
            <a href="http://{$smarty.const.DOMAIN}/article?a=1521" target="_top">Privacy</a>
        </td>
        <td style="vertical-align:middle;">
            <a href="http://{$smarty.const.DOMAIN}/article?a=1395" target="_top">Guarantee</a>
        </td>

        <td rowspan="2" style="width:160px;">
            <script src="http://www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/translatemypage.xml&up_source_language=en&w=160&h=60&title=&border=&output=js"></script>
        </td>
    </tr>
    <tr>
        <td style="vertical-align:middle;">
            <a href="http://{$smarty.const.DOMAIN}/article?a=3069" target="_top">About Us</a>
        </td>
        <td style="vertical-align:middle;">
            <a href="http://{$smarty.const.DOMAIN}/article?a=1467" target="_top">Shipping</a>
        </td>
        <td style="vertical-align:middle;">
            <a href="http://{$smarty.const.DOMAIN}/article?a=12342383" target="_top">Why Buy From Us</a>
        </td>
        <td style="vertical-align:middle;">
            <a href="http://{$smarty.const.DOMAIN}/article?a=1397" target="_top">Contact Us</a>
        </td>
        <td style="vertical-align:middle;">
            <a href="http://{$smarty.const.DOMAIN}/help" target="_top">Help</a>
        </td>
    </tr>
</table>

      

The problem is that WebKit makes the top line very small and the bottom line fills the rest of the space instead of each line with equal height.

Anyone have any ideas how to get it to show how I want it in WebKit based browsers?

-1


source to share


3 answers


I have a few guidelines for you, but I cannot fully answer your question because WebKit seems to transmit your source perfectly when I try it.

  • First, perhaps you can change width="100%"

    to style="width:100%;"

    Maybe in conjunction with other markup by putting the browser in quirks mode.
  • Second, make sure you have the correct doctype and your code is validated or AT LEAST is close. The document type I used when copying and pasting the code was XHTML Strict.


If not, please post the source code of the entire page or just a link to the live demo. Even a screenshot will help.

+1


source


I could help more with a live example for testing, but you can try adding it in tags tr

.

<tr style="height: 50%;">

      



Assuming you only need two lines, this will bring them to the same height.

0


source


The correct example to make sure it doesn't display correctly in webkit is the following:

<table width="200" border="1">
  <tbody>
    <tr>
      <td rowspan="2" width="15">
        this is a very high rowspan 2 row that will thus be split over 2 rows, it prevents the second row from being formatted in height
      </td>
      <td>
        this should be big instead
      </td>
    </tr>
    <tr height="20">
      <td height="20">
        this row fails to size to 20 height on webkit
      </td>
    </tr>
  </tbody>
</table>

      

as you can see the left side renders fine, but the right side should be different as the top row needs to fill the left space and the bottom row is set to 20 heights (since you can see neither tr height or td height taken into account by webkit). this displays everything in all other browsers

EDIT: After playing around and tackling my problem, I came up with the solution below. Relying entirely on jquery, reading the height attribute property from the line you want to change:

<html>
<head>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("#pipnorowspan").height(function(){
    return $("#rcarowspan").height() - $("#piplowerrow").attr('height') + 2;
});
});
</script>
</head>
<body>
<table width="200" style="border-collapse:collapse; border:1px solid #000;" id="ertable">
  <tbody>
    <tr style="border:1px solid #000;">
      <td rowspan="3" width="15" id="rcarowspan" style="border:1px solid #000;">
        this is a very high rowspan 2 row that will thus be split over 2 rows, it prevents the second row from being formatted in height
      </td>
      <td id="pipnorowspan" style="border:1px solid #000;">
        this should be big instead
      </td>
    </tr>
    <tr height="20" id="piplowerrow" style="border:1px solid #000;">
      <td height="20" style="border:1px solid #000;">
        this row fails to size to 20 height on webkit
      </td>
    </tr>
  </tbody>
</table>
</body>
</html>

      

0


source







All Articles