html - 表格显示问题,仅在 Chrome 中

标签 html css google-chrome css-tables

我真的不知道如何处理这个问题,该表在 Firefox/IE 上运行良好

参见: tablefire/ie

在 Chrome 上: tablechrome

这是表格的实际CSS

table {
padding: 24px;
margin: 0 auto;
width: 550px;   
}

td#tadmin

td#tabmin {
width: 30px;
height: auto;
float: left;
font-family: "Roboto","Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 15px;
}

尝试过

table-layout: fixed;

不工作。

根据要求,我使用 echo 在 php 中显示表格:

echo "<table style='padding:24px;margin:0 auto;width:550px;'>".  
  "<tr>".
     "<td id=tabmin  >".
     "<div class=tabminscale style=text-align:center;>"
     .$row['min']."'"."</div>". 
     "</td>".
       "<td id=tabcom >" .
       "<div id=commentaires>".
       $row['commentaire']."</br>".
       "</td>".
"</tr>".
</div>";

最佳答案

您的标记是 invalid .始终使用 validator 检查您的标记.

因此,如果您删除 PHP 内容,您将获得:

<table style='padding:24px;margin:0 auto;width:550px;'>
    <tr>
        <td id=tabmin>
            <div class=tabminscale style=text-align:center;>foo</div>
        </td>
        <td id=tabcom>
            <div id=commentaires>bar</br> <!-- invalid closing for br tag -->
        </td>
    </tr>
    </div> <!-- wrong -->
    <!-- where's </table>? -->
    <!-- also add quotes to HTML Attributes-->

将其更改为:

<table style='padding:24px;margin:0 auto;width:550px;'>
    <tr>
        <td id='tabmin'>
            <div class='tabminscale' style='text-align:center;'>foo</div>
        </td>
        <td id='tabcom'>
            <div id='commentaires'>bar<br/></div>
        </td>
    </tr>
</table>

关于html - 表格显示问题,仅在 Chrome 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31883175/

相关文章:

html - tricky css : 3 sections in a row, 所有 3 都可以是可变宽度

html - 导航下拉菜单时保留悬停样式

css - 如何修复 firefox 和 chrome 中的空间?

javascript - Bootstrap Modal - 使用 Javascript 将数据传递到 Modal

php - 获取带空格的变量

html - 制作垂直的日语文本

google-chrome - Chrome 扩展注入(inject)远程 JS 文件?

html - Web 字体无法应用于在浏览器上工作的时事通讯(GMAIL、Yahoo Mail、Outlook、Hotmail 等)

javascript - 在复选框按钮选项列表上应用 css 规则

html - 按钮在 Google Chrome (MAC) 上看起来不同