【问题标题】:Table doesn't display correctly when narrow (WordPress)缩小时表格无法正确显示(WordPress)
【发布时间】:2015-04-10 07:11:30
【问题描述】:

我对尝试在 WordPress 中设置的表格感到有些遗憾。 Have a look here - 页面在正常桌面宽度(比如 1000 像素)时看起来不错,但是当您将其缩小到大约 750 像素以下时,表格会无缘无故地重复信息。我浏览了我的 CSS 和我的表格本身,但似乎找不到任何直接的原因。这只是移动用户尝试查看页面时的问题。

其中一张表如下。

<table style="height: 25px;" border="1" width="673" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="text-align: center;" valign="bottom" width="206"><em><strong>WEEK</strong></em></td>
<td style="text-align: center;" valign="bottom" width="206"><em><strong>PRICE</strong></em></td>
<td style="text-align: center;" valign="bottom" width="206"><em><strong>AVAILABLE</strong></em></td>
</tr>
</tbody>
</table>
<table style="height: 120px;" border="1" width="673" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="text-align: center;" valign="bottom" width="206"><em><strong> 3rd Jan to 10th Jan</strong></em></td>
<td style="text-align: center;" valign="bottom" width="206"><em><strong>£359</strong></em></td>
<td style="text-align: center;" valign="bottom" width="206"><em><strong>Available </strong></em></td>
</tr>
<tr>
<td style="text-align: center;" valign="bottom" width="206"><em><strong>10th Jan to 17th Jan</strong></em></td>
<td style="text-align: center;" valign="bottom" width="206"><em><strong>£359</strong></em></td>
<td style="text-align: center;" valign="bottom" width="206"><em><strong> <strong><em>Available </em></strong></strong></em></td>
</tr>
<tr>
<td style="text-align: center;" valign="bottom" width="206"><em><strong>17th Jan to 24th Jan</strong></em></td>
<td style="text-align: center;" valign="bottom" width="206"><em><strong>£359</strong></em></td>
<td style="text-align: center;" valign="bottom" width="206"><em><strong> <strong><em>Available </em></strong></strong></em></td>
</tr>
<tr>
<td style="text-align: center;" valign="bottom" width="206"><em><strong>24th Jan to 31st Jan</strong></em></td>
<td style="text-align: center;" valign="bottom" width="206"><em><strong>£359</strong></em></td>
<td style="text-align: center;" valign="bottom" width="206"><span style="color: #ff0000;"><em><strong> <span style="color: #000000;"><strong><em>Available </em></strong></span></strong></em></span></td>
</tr>
<tr>
<td style="text-align: center;" valign="bottom" width="206"><b><i>31st Jan to 7th Feb</i></b></td>
<td style="text-align: center;" valign="bottom" width="206"><em><strong>£359</strong></em></td>
<td style="text-align: center;" valign="bottom" width="206"><em><strong> <span style="color: #ff0000;"><strong><em>BOOKED</em></strong></span></strong></em></td>
</tr>
</tbody>
</table>

你知道为什么会这样吗?

【问题讨论】:

  • responsive-tables.js引起,函数splitTable,该文件第10行:if ((jQuery(window).width() &lt; 767) &amp;&amp; !switched ){...
  • @panther 你真是个天才——谢谢!

标签: html css wordpress html-table


【解决方案1】:

如果没有看到你的 CSS 就很难确定,但是会为 785px 设置一个断点,显示具有“固定”类的元素,从而出现重复的表格条目。

尝试:

@media all max-width: 785px {
  .pinned {
    display:none !important;
  }
}

【讨论】:

  • 最好是找到一段代码来修复它,而不是把这段代码隐藏在 CSS 中。
猜你喜欢
  • 2011-01-07
  • 1970-01-01
  • 1970-01-01
  • 2011-11-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多