html - Bootstrap 只删除一个单元格

标签 html css twitter-bootstrap

我目前正在使用 bootstrap 处理一个表,我想隐藏或删除该表中的一个单元格。

屏幕:http://perche.jeremy.free.fr/tab.png (我发链接是因为发不了图^^) 所以我想隐藏或删除红色的单元格,我没有看到任何解决方案...

编辑:

                    <div class="widget stacked widget-table action-table">
                    <div class="widget-content">
                        <table class="table table-striped table-bordered">
                    <thead>
                        <tr>
                            <th></th>
                            <th>Avant</th>
                            <th>Aujourd'hui</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td colspan="3" class="text-center" style="background-color:#C0C0C0;"><strong>Catégorie 1</strong></td>
                        </tr>
                        <tr>
                            <td>Check1</td>
                            <td>20</td>
                            <td>40</td>
                        </tr>
                        <tr>
                            <td>Check1</td>
                            <td>20</td>
                            <td>40</td>
                        </tr>
                        <tr>
                            <td colspan="3" class="text-center" style="background-color:#C0C0C0;"><strong>Catégorie 2</strong></td>
                        </tr>
                        <tr>
                            <td>Check2</td>
                            <td>Oui</td>
                            <td>Oui</td>
                        </tr>
                        <tr>
                            <td>Check2</td>
                            <td>Oui</td>
                            <td>Non</td>
                        </tr>
                    </tbody>
                        </table>
                    </div>
                </div>

最佳答案

一个解决方案是隐藏这个额外的 <th></th>例如

table thead tr th:first-child {
   background: none;
}

或与

/* Better if there is content in it, or if there is no background defined at start */

table thead tr th:first-child {
   opacity: 0; 
}

有几个CSS方法来做到这一点,但这就是我会做的。希望你明白了。

因为你已经有了一些 inline CSS如果你不知道如何处理这个 CSS , 你也可以用 inline CSS方式,即使它明显不如其他方式干净

<thead>
  <tr>
    <th style="opacity: 0;"></th>
    <th>Avant</th>
    <th>Aujourd'hui</th>
  </tr>
</thead>

JsFiddle:

background: none;解决方案:http://jsfiddle.net/5omkdhnu/1/

opacity: 0;解决方案:http://jsfiddle.net/5omkdhnu/2/

关于html - Bootstrap 只删除一个单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31695414/

相关文章:

javascript - 如何正确使用document.getElementById()?

javascript - 单击链接时如何使跨度更改颜色

javascript - 使用 HTML 5 File API 加载 JSON 文件

html - 调整表格中标签/输入的高度

css - 在 CSS 中链接相邻的兄弟运算符

html - Bootstrap 基本网格布局冲突

python - 如何将 <br> 和 <p> 变成换行符?

javascript - SVG位移贴图过滤器

javascript - Bootstrap 旋转木马放大到淡出

php - 当我使用以下代码 : 从目录中调用导航时,下拉导航菜单中断