首页 > 解决方案 > 防止 div 从表 th 中的新行开始

问题描述

如您所见,进度条与文本不符。该栏是一个单独的 div:

            <th width="300px">
    Atv opgenomen / totaal: 22:48 h / 62.0 h
            </th>
            <th>
<?php
                echo '<div class="progress">
                  <div class="progress-bar" role="progressbar" aria-valuenow="'.$perc_bar_atv.'" aria-valuemin="0" aria-valuemax="100" style="width: '.$perc_bar_atv.'%;">
                    '.round($perc_bar_atv).'%
                  </div>
                </div>';
            ?>
        </th>

任何建议如何获得这个内联?我试过style="display: inline"了,但删除了一些标记

style="display: inline-block; vertical-align:center"

标签: phphtmlcsstwitter-bootstrap-3

解决方案


似乎设置适当的边距.progress就足够了,像这样:

.progress {
    margin: 10px 0 !important;
}

或这个

.progress {
    margin: auto 0 !important;
}

.progress {
    margin: 10px 0 !important;
}
 th {
     border: 1px solid green;
}
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
<table>
<tr>
<th width="300px">
    Atv opgenomen / totaal: 22:48 h / 62.0 h
            </th>
            <th width="300px">
<div class="progress">
                  <div class="progress-bar" role="progressbar" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100" style="width: 100%;">50%</div>
                </div>
        </th>
</tr>
</table>


推荐阅读