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()

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

报告相同问题?

悬赏问题

  • ¥15 mmocr的训练错误,结果全为0
  • ¥15 python的qt5界面
  • ¥15 无线电能传输系统MATLAB仿真问题
  • ¥50 如何用脚本实现输入法的热键设置
  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀