【发布时间】:2021-12-29 13:17:31
【问题描述】:
我有一个引导行,我希望第一列有蓝色背景,文本垂直和水平居中。
如果我不水平居中文本,它可以工作 HTML
<div class = "shadow p-3 mb-5 bg-white rounded" style="padding: 0 !important;">
<div class="container">
<div class="row main-row">
<div class="col-2 booking-flight-info-dir text-center " style="">
<img src="<?= plugin_dir_url( __DIR__ ).'/img/out_flight_icon.png'?>" alt="out_flight_icon.png" style="padding-left:10px " >
<span >תיסת הלוך</span>
</div>
<div class="col-2 booking-flight-info-flightnum text-center my-auto" style="">
<span>טיסה מספר:</span><BR>
<span style="font-size: x-large;font-weight: bold;text-align: center"><?= $rowData->outTrip->flightNmr?></span>
</div>
</div>
</div>
</div>
但是,一旦我将 my-auto 添加到水平居中的 tex 中,背景颜色就不会填充整个行高,只会填充文本区域。
<div class = "shadow p-3 mb-5 bg-white rounded" style="padding: 0 !important;">
<div class="container">
<div class="row main-row">
<div class="col-2 booking-flight-info-dir text-center my-auto " style="">
<img src="<?= plugin_dir_url( __DIR__ ).'/img/out_flight_icon.png'?>" alt="out_flight_icon.png" style="padding-left:10px " >
<span >תיסת הלוך</span>
</div>
<div class="col-2 booking-flight-info-flightnum text-center my-auto" style="">
<span>טיסה מספר:</span><BR>
<span style="font-size: x-large;font-weight: bold;text-align: center"><?= $rowData->outTrip->flightNmr?></span>
</div>
</div>
</div>
</div>
【问题讨论】:
标签: twitter-bootstrap background row height fill