html - 使用 Bootstrap 对齐 HTML 中的文本

标签 html css twitter-bootstrap

示例

 text a b c d
 text2 a b c d
 text3 a b c d

结果应该是

 text              a              b           c           d
 text2             a              b           c           d
 text3             a              b           c           d

我该怎么做?解决方案可能不依赖于 Bootstrap 。只是为了获得这样的 View 。

最佳答案

http://jsfiddle.net/ptwL7

HTML

<table class="kenos-table">

    <th colspan="4">You could have a header if you wanted</th>

    <tr>
        <td>text 1</td>
        <td>a</td>
        <td>b</td>
        <td>c</td>
        <td>d</td>
    </tr>

    <tr>
        <td>text 2</td>
        <td>a</td>
        <td>b</td>
        <td>c</td>
        <td>d</td>
    </tr>

    <tr>
        <td>text 3</td>
        <td>a</td>
        <td>b</td>
        <td>c</td>
        <td>d</td>
    </tr>

    <tr>
        <td>text 4</td>
        <td>a</td>
        <td>b</td>
        <td>c</td>
        <td>d</td>
    </tr>

</table>

CSS

.kenos-table {
    width: 100%;
    max-width: 40em;
    border: 1px solid orange;
    border-collapse: collapse; /* key - remove me to see */   
}

.kenos-table th {
    display: none;
}

.kenos-table tr {
    /* - */
}

.kenos-table td {
    width: 20%;
    border: 1px solid gray;
}

关于html - 使用 Bootstrap 对齐 HTML 中的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22433526/

相关文章:

html - 如何将div包裹在图像周围?

javascript - 仅展开单击的列

firefox - CSS3 旋转 - 在 Firefox 和 Safari 中呈现问题

node.js - 在 Node.js 上使用holder.js 和 Express Web 框架确实有效

html - HTML5 Canvas 中的动画 GIF

javascript - 更改 HTML 元素 (div) 的内容几秒钟

javascript - 如何以 300 dpi 分辨率打印 html 页面

html - 在动画中调整 div 大小时变换原点问题

css - 使用单个 Controller 控制两个 Partials 时不加载 Angular css 文件

grails - 带有navbar-fixed-top的Grails Twitter Bootstrap插件问题