dotelauv682684 2013-08-18 23:40
浏览 74
已采纳

PHP动态表格宽度仅在Chrome中正确显示(不是Firefox,Internet Explorer或Safari)。 为什么是这样?

Images are displayed underneath description of the problem; labeled respectively. Code is displayed at the end of the post.

The code displays correctly as shown in chrome (image 1), but incorrectly in firefox, internet explorer (referred to as I.E. later in post) and safari (image 2). When the table heading contents are removed, the table widths display correctly (image 3). I know the table widths are being calculated correctly as the <td>...</td> part of the table is consistently correct across all three browsers. The issue is purely in the display, does anyone have any ideas on how to fix this?

As the table should be displayed in Chrome:

http://imgur.com/a/FlwYX

The table in IE/Firefox/Safari:

http://imgur.com/a/FlwYX

The table in IE/Firefox/Safari when the <th>... </th> contents are emptied (no other code changes):

http://imgur.com/a/FlwYX

Code for table headings:

echo "<table class='main' style='width: 100%;' cellpadding='0' cellspacing='0'><tr>";
echo "<th style='width: 20%;'>Student Name</th>";
while($row2 = mysql_fetch_array($result2))
{
    extract($row2);
    echo "<th style='width: calc(80% / ".$numclasses.");'>**".$classname."**</th>";
}
echo "<th style='width: calc(80% / ".$numclasses.");'>**No Class**</th>";
...<insert correctly behaving <td>...</td> here...
echo "</table>";
  • 写回答

1条回答 默认 最新

  • dongmei9961 2013-08-18 23:43
    关注

    the calc css property works on latest version of browsers.You can use vender prefixes for for some older ones. The best thing to do is calculate the calculation in php and then output the result using echo.check this in can i use calc()

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?