css - 在列的每一端对齐文本 - Bootstrap

标签 css twitter-bootstrap text-align

我有一个响应表,其中最后一列显示金钱数字。目前它看起来像这样: Text currently

但我希望它这样做:

Desired result

可能没有任何数据,因此 £ 符号将替换为 N/A,它也应该被拉到列的右侧。

数据是从 MySQL 中获取的,但这里是我的代码的简化片段:

<table id="mytable" class="table table-bordred table-striped">
<thead>
    <th>Reference</th>
    <th>Client</th>
    <th>Description</th>
    <th>Money</th>
</thead>
<tbody>
        <tr>
            <td>#1234</td>
            <td>Josh Blease</td>
            <td>Needs a new filter fixing</td>
            <td class='money'>
                <div class='text-right'>Budget: £123,456</div>
                <div class='text-right'>Value: £200,000</div>
                <div class='text-right'>Spent: N/A</div>
            </td>
        </tr>
</tbody>

最佳答案

Divs 很有用,但我认为这不是这种情况的最佳解决方案,也许您需要更好地使用表格属性

http://www.usabilidad.tv/tutoriales_html/colspan_y_rowspan.asp

<table id="mytable" class="table table-bordred table-striped">
  <thead>
    <th>Reference</th>
    <th>Client</th>
    <th>Description</th>
    <th colspan="2">Money</th>
  </thead>
  <tbody>
    <tr>
      <td rowspan="4">#1234</td>
      <td rowspan="4">Josh Blease</td>
      <td rowspan="4">Needs a new filter fixing</td>
    </tr>
    <tr>
      <td>Budget</td>
      <td>£123,456</td>

    </tr>
    <tr>
      <td>Value</td>
      <td>£200,000</td>
    </tr>
    <tr>
      <td>Spent</td>
      <td>N/A</td>
    </tr>
  </tbody>
</table>

关于css - 在列的每一端对齐文本 - Bootstrap,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32638201/

相关文章:

css - 我怎样才能证明放置在多行和多列上的文本

html - 如何使用 CSS 使按钮居中?

html - (Bootstrap 3) 如果前面有 float 图像,<dl> 列表会中断

php - 对于功能不起作用

html - css 图像居中的意外元素行为

javascript - Bootstrap 的日期选择器(仅选择周并使其在 IE 中工作)

html - 文字在某些电子阅读器应用程序上不合理,但在其他应用程序上会

javascript - NodeJS+Bootstrap+CSS : home buildup thumbnail gallery add white background to images

html - Bootstrap 网格列不对齐

html - 如何使缩略图文本在 Bootstrap 的小视口(viewport)上正确 float