Firefox table 的单元格宽度与 Chrome 的完全不同

Firefox table cell width completly different than Chrome's

我的 table 单元格宽度有问题。在 Chrome 上它运行完美,但在 Firefox 上它看起来有很大不同,我不知道是什么原因造成的。

这是 chrome 的,看起来很完美:

这是 Firefox 版,被挤得紧紧的:

知道这是为什么吗?这是我的代码。

/* Latest games */
.lp-latestgames {
    height: 466px;
}
.lp-latestgames .title {
    margin-left: 460px;
    margin-top: 56px;
    margin-bottom: 21px;
}
.lp-latestgames .table {
    margin-bottom: 0;
}
.lp-latestgames .table thead {
    background-color: rgba(0, 0, 0, 0.45);
}
.lp-latestgames .table thead th {
    font-size: 16px;
    font-weight: 500 !important;
    color: white;
    height: 49px;
    vertical-align: middle;
}
.lp-latestgames .table thead > tr > th { border-bottom: none; }
.lp-latestgames .table tbody > tr > td {
    height: 81px;
    border-top: 2px solid #111316;
    background-color: rgba(0, 0, 0, 0.19);
    vertical-align: middle;
    font-size: 14px;
    font-weight: 500;
    color: white;
}
.lp-latestgames .table tbody > tr:first-child > td { border-top: none; }
.lp-latestgames .table tbody > tr > td:first-child,
.lp-latestgames .table thead > tr > th:first-child{
    /* ÜBERARBEITEN!!!!! */
    padding-left: 460px;
    max-width: 200px;
}
.lp-latestgames .table tbody > tr > td:last-child,
.lp-latestgames .table thead > tr > th:last-child{
    /* ÜBERARBEITEN!!!!! */
    padding-right: 460px;
    max-width: 200px;
}
.lp-latestgames .table tbody > tr > td > .gd-c-versus {
    display: block;
    font-weight: normal;
    font-family: Arial;
    color: #494949;
}
.lp-latestgames .table thead > tr > th:nth-child(4),
.lp-latestgames .table thead > tr > th:nth-child(5),
.lp-latestgames .table tbody > tr > td:nth-child(4),
.lp-latestgames .table tbody > tr > td:nth-child(5) {
    text-align: center;
}
<div class="lp-latestgames">
        <!-- Games -->
        <table class="table">
            <thead>
            <tr>
                <th>Name <img src="img/gd_content_arrow_dn.png"></th>
                <th>Price Pool <img src="img/gd_content_arrow_dn.png"></th>
                <th>Entry <img src="img/gd_content_arrow_dn.png"></th>
                <th>Avg Skill <img src="img/gd_content_arrow_dn.png"></th>
                <th>Time Remaining <img src="img/gd_content_arrow_up.png"></th>
            </tr>
            </thead>
            <tbody>
            <tr>
                <td>Im bored. Fite me<span class="gd-c-versus">1 vs 1</span></td>
                <td><img src="img/gd_content_coin.png"> 20</td>
                <td><img src="img/gd_content_coin.png"> 10</td>
                <td><input type="text" value="730" class="circle"></td>
                <td>00:00:32</td>
            </tr>
            <tr>
                <td>EG vs LGD - Wild Cards Entry<span class="gd-c-versus">5 vs 5</span></td>
                <td><img src="img/gd_content_coin.png"> 1.500.000</td>
                <td><img src="img/gd_content_coin.png"> 20</td>
                <td><input type="text" value="980" class="circle"></td>
                <td>00:01:47</td>
            </tr>
            <tr>
                <td>cyka blyat<span class="gd-c-versus">5 vs 5</span></td>
                <td><img src="img/gd_content_coin.png"> 20</td>
                <td><img src="img/gd_content_coin.png"> 10</td>
                <td><input type="text" value="730" class="circle"></td>
                <td>00:02:4</td>
            </tr>
            </tbody>
        </table>
    </div>

您是否在 html 页面中声明了 <!DOCTYPE>,如果没有,请尝试一下。此文档类型是向 Web 浏览器发出的关于页面所用 HTML 版本的说明。

尝试添加这个:

.table { table-layout: fixed }

查看代码片段 参见

/* Latest games */

.lp-latestgames {
  height: 466px;
}
.lp-latestgames .title {
  margin-left: 460px;
  margin-top: 56px;
  margin-bottom: 21px;
}
.lp-latestgames .table {
  margin-bottom: 0;
  table-layout: fixed;    /*<<<=====  ADD THIS RULE RIGHT HERE */ 
}
.lp-latestgames .table thead {
  background-color: rgba(0, 0, 0, 0.45);
}
.lp-latestgames .table thead th {
  font-size: 16px;
  font-weight: 500 !important;
  color: white;
  height: 49px;
  vertical-align: middle;
}
.lp-latestgames .table thead > tr > th {
  border-bottom: none;
}
.lp-latestgames .table tbody > tr > td {
  height: 81px;
  border-top: 2px solid #111316;
  background-color: rgba(0, 0, 0, 0.19);
  vertical-align: middle;
  font-size: 14px;
  font-weight: 500;
  color: white;
}
.lp-latestgames .table tbody > tr:first-child > td {
  border-top: none;
}
.lp-latestgames .table tbody > tr > td:first-child,
.lp-latestgames .table thead > tr > th:first-child {
  /* ÜBERARBEITEN!!!!! */
  padding-left: 460px;
  max-width: 200px;
}
.lp-latestgames .table tbody > tr > td:last-child,
.lp-latestgames .table thead > tr > th:last-child {
  /* ÜBERARBEITEN!!!!! */
  padding-right: 460px;
  max-width: 200px;
}
.lp-latestgames .table tbody > tr > td > .gd-c-versus {
  display: block;
  font-weight: normal;
  font-family: Arial;
  color: #494949;
}
.lp-latestgames .table thead > tr > th:nth-child(4),
.lp-latestgames .table thead > tr > th:nth-child(5),
.lp-latestgames .table tbody > tr > td:nth-child(4),
.lp-latestgames .table tbody > tr > td:nth-child(5) {
  text-align: center;
}
<div class="lp-latestgames">
  <!-- Games -->
  <table class="table">
    <thead>
      <tr>
        <th>Name
          <img src="img/gd_content_arrow_dn.png">
        </th>
        <th>Price Pool
          <img src="img/gd_content_arrow_dn.png">
        </th>
        <th>Entry
          <img src="img/gd_content_arrow_dn.png">
        </th>
        <th>Avg Skill
          <img src="img/gd_content_arrow_dn.png">
        </th>
        <th>Time Remaining
          <img src="img/gd_content_arrow_up.png">
        </th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>Im bored. Fite me<span class="gd-c-versus">1 vs 1</span>
        </td>
        <td>
          <img src="img/gd_content_coin.png">20</td>
        <td>
          <img src="img/gd_content_coin.png">10</td>
        <td>
          <input type="text" value="730" class="circle">
        </td>
        <td>00:00:32</td>
      </tr>
      <tr>
        <td>EG vs LGD - Wild Cards Entry<span class="gd-c-versus">5 vs 5</span>
        </td>
        <td>
          <img src="img/gd_content_coin.png">1.500.000</td>
        <td>
          <img src="img/gd_content_coin.png">20</td>
        <td>
          <input type="text" value="980" class="circle">
        </td>
        <td>00:01:47</td>
      </tr>
      <tr>
        <td>cyka blyat<span class="gd-c-versus">5 vs 5</span>
        </td>
        <td>
          <img src="img/gd_content_coin.png">20</td>
        <td>
          <img src="img/gd_content_coin.png">10</td>
        <td>
          <input type="text" value="730" class="circle">
        </td>
        <td>00:02:4</td>
      </tr>
    </tbody>
  </table>
</div>

尝试使用 rem 而不是 px 设置 th 或 td 宽度 每个 rem 等于 16px