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

时间:2015-11-19 12:49:44

标签: html css google-chrome firefox css-tables

我的表格单元格宽度有问题。在Chrome上它运行得很好,但在Firefox上它看起来很不一样,我不知道是什么导致它。

这是镀铬的,看起来很完美: enter image description here

这是一个被紧缩的Firefox: enter image description here

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

/* 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>

3 个答案:

答案 0 :(得分:1)

您是否在html页面中声明了<!DOCTYPE>,如果没有试一试。此doctype是向Web浏览器发出的关于页面编写的HTML版本的说明。

答案 1 :(得分:0)

尝试添加此内容:

.table { table-layout: fixed }

请参阅代码段 见POST

/* 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>

答案 2 :(得分:0)

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