html - 使用 Bootstrap 3 如何隐藏表中的列?

标签 html css twitter-bootstrap responsive-design html-table

我试图在 col-xscol-sm 中隐藏响应式设计的列。我首先尝试使用 hidden-xs/hidden-sm 类,但这没有用。我还尝试使用 visible-desktop ,如下所述:Twitter Bootstrap Responsive - Show Table Column only on Desktop

那也没用。做这个的最好方式是什么?我宁愿不做两个单独的表,然后隐藏一个或另一个。

我试过但目前无法运行的代码:

<table>
    <thead>
        <th>Show All the time</th>
        <th class="hidden-xs hidden-sm">Hide in XS and SM</th>
    </thead>
    <tbody>
        <tr>
            <td>Show All the time</td>
            <td class="hidden-xs hidden-sm">Hide in XS and SM</td>
        </tr>
    </tbody>
</table>

最佳答案

似乎 hidden-xs/hidden-sm 之前工作过,因为接受的答案有很多赞成票,但是当我调整区域大小时, fiddle 示例对我不起作用。不过,对我有用的是使用 visible-md/visible-lg 的相反逻辑。我不明白为什么,因为根据文档 Bootstrap 应该仍然支持 hidden-xs/hidden-sm .

工作 fiddle :http://jsfiddle.net/h1ep8b4f/

<table>
    <thead>
        <th>Show All the time</th>
        <th class="visible-md visible-lg">Hide in XS and SM</th>
    </thead>
    <tbody>
        <tr>
            <td>Show All the time</td>
            <td class="visible-md visible-lg">Hide in XS and SM</td>
        </tr>
    </tbody>
</table>

关于html - 使用 Bootstrap 3 如何隐藏表中的列?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18362893/

相关文章:

javascript - Jquery rolloever - 闪烁问题

javascript - 像 Scratch 或 Google AppInventor 之类的东西,但不是针对 JavaScript 或 HTML5 的吗?

html - CSS 宽度和边距百分比不符合我的要求

javascript - 隐藏和显示错误

html - 如何在 Bootstrap 中将左侧边栏置于移动 View 内容下方?

css - 媒体查询在我的 Iphone 中不工作,但在我调整浏览器大小时在浏览器中工作

jquery - 如何修复类似于 Bootstrap 站点的侧边栏?

css - 将 HTML5 [hidden] 设置为 true 的元素的 CSS 选择器是什么?

css - 不使用表格的简单两列 html 布局

javascript - Bootstrap 轮播内的图标单击事件在 Chrome 中未触发但在 IE 中正常