Html Bootstrap 左侧的表头?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/28612699/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 03:32:51  来源:igfitidea点击:

table header on left side in Bootstrap?

html

提问by Manual

I haven't seen any examples while searching through google. I've tried making theadfloat on left and tbodyon the right, but it didn't work. How to have a table header on the left side instead of showing it on the top ?

我在谷歌搜索时没有看到任何例子。我试过thead在左侧和tbody右侧浮动,但没有奏效。如何在左侧有一个表格标题而不是在顶部显示?

<table class="table">
    <thead>
        <tr>
            <th>Row</th>
            <th>First Name</th>
            <th>Last Name</th>
            <th>Email</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>1</td>
            <td>John</td>
            <td>Carter</td>
            <td>[email protected]</td>
        </tr>
        <tr>
            <td>2</td>
            <td>Peter</td>
            <td>Parker</td>
            <td>[email protected]</td>
        </tr>
        <tr>
            <td>3</td>
            <td>John</td>
            <td>Rambo</td>
            <td>[email protected]</td>
        </tr>
    </tbody>
</table>

回答by Ted

If you want the headers down the left side of your table, simply write the markup differently:

如果您想要表格左侧的标题,只需以不同的方式编写标记:

<table class="table">
    <tbody>
        <tr>
          <th>Row</th>
            <td>1</td>
            <td>2</td>
            <td>3</td>
        </tr>
        <tr>
          <th>First Name</th>
            <td>John</td>
            <td>Peter</td>
            <td>John</td>
        </tr>
        <tr>
          <th>Last Name</th>
            <td>Carter</td>
            <td>Parker</td>
            <td>Rambo</td>
        </tr>
        <tr>
          <th>Email</th>
            <td>[email protected]</td>
            <td>[email protected]</td>
            <td>[email protected]</td>
        </tr>
    </tbody>
</table>

See this demo

这个演示