gpt4 book ai didi

html - 如何让两个 Bootstrap 列彼此相邻

转载 作者:行者123 更新时间:2023-11-28 15:03:15 24 4
gpt4 key购买 nike

我在将两个列彼此对齐时遇到了问题。我觉得我做得对,但我想不是……现在第二个 div(col-11)出现在 col-1 下方。 col-1 里面有一个图像,我想在最左边,另一个 col 就在它旁边。

<div class="container col-md-12 wm-body">

<div class="row" style="margin: 0px;">

<div class="col-md-12" style="padding-left: 0px;">

<div class="container-fluid" style="padding: 0;">
<div class="row wm-card" style="margin: 15px 0 0 0; padding: 0px;">

<div class="col-md-1">
<img src="../../../assets/img/trip.svg" class="icon">
</div>

<div class="col-md-11">
<table *ngIf="trip" class="table-sm wm-table-drive-orders" style="width: 60%;">

<div>
<tbody class="col-md-12">
<tr *ngIf="firstNode">



<td style="padding-bottom: 0px;">
<b>Datum</b>
</td>

<td style="padding-bottom: 0px;">
<p>{{ tripHelper.getActualTimeStringFromNode(firstNode) }}</p>
</td>

<td style="padding-bottom: 0px;">
<i class="fa" aria-hidden="true" [ngClass]="tripHelper.getState(firstNode)" [ngStyle]="{'color':
tripHelper.getState(firstNode, true)}"></i>
</td>



<td style="padding-bottom: 0px;">
<p>{{ geographyHelper.getAddressString(trip.addresses[0]) }}, {{ geographyHelper.getPostalAreaString(trip.addresses[0])}}
</p>
</td>

<td style="padding-bottom: 0px;">
<!--<ng-container *ngIf="trip.people">
<p>{{peopleHelper.getPeopleNameString(trip.people)}} </p>
</ng-container>-->
<b>Tidskrav</b>
</td>
<td style="padding-bottom: 0px;">
<!-- TODO: Add seat description -->
<b>Status</b>
</td>
</tr>
</tbody>
</div>
</table>

<table>
<tbody class="col-md-12">
<tr *ngIf="lastNode">

<td style="padding-top: 0px;">
<p>{{tripHelper.getDateString(trip)}}</p>
</td>

<td style="padding-top: 0px;">
<i class="fa" aria-hidden="true" [ngClass]="tripHelper.getState(lastNode)" [ngStyle]="{'color':
tripHelper.getState(lastNode, true)}"></i>
</td>

<td style="padding-top: 0px;">
<p>{{ geographyHelper.getAddressString(trip.addresses[1]) }}, {{ geographyHelper.getPostalAreaString(trip.addresses[1])}}
</p>
</td>

<td style="padding-top: 0px;">
<!--<ng-container *ngIf="trip.people">
<p>{{peopleHelper.getPeopleNameString(trip.people)}} </p>
</ng-container>-->
<p>-</p>
</td>
<td style="padding-top: 0px;">
<!-- TODO: Add seat description -->
<p>{{tripHelper.getStateString(trip)}}</p>
</td>
</tr>
</tbody>
</table>

</div>

</div>
</div>

</div>

我不确定是不是因为我在 div 中有表格?老实说,我不知道。

最佳答案

您遇到问题的原因是因为您以错误的方式嵌套了容器、行和列-*。 Bootstrap 建议使用容器作为行的父级,而不是在行或列内。而且,你不应该将 col-* 嵌套在另一个 col-* 中,除非你使用一行来包裹内部的 col-*。试试这段代码,让它更清晰。

<div class="container wm-body">

<div class="wm-card" style="margin: 15px 0 0 0; padding: 0px;">
<div class="row" style="margin: 0px;">

<div class="col-md-1">
<img src="../../../assets/img/trip.svg" class="icon">
</div>

<div class="col-md-11">
<table *ngIf="trip" class="table-sm wm-table-drive-orders" style="width: 60%;">

<div>
<tbody class="col-md-12">
<tr *ngIf="firstNode">



<td style="padding-bottom: 0px;">
<b>Datum</b>
</td>

<td style="padding-bottom: 0px;">
<p>{{ tripHelper.getActualTimeStringFromNode(firstNode) }}</p>
</td>

<td style="padding-bottom: 0px;">
<i class="fa" aria-hidden="true" [ngClass]="tripHelper.getState(firstNode)" [ngStyle]="{'color':tripHelper.getState(firstNode, true)}"></i></td>



<td style="padding-bottom: 0px;">
<p>{{ geographyHelper.getAddressString(trip.addresses[0]) }}, {{ geographyHelper.getPostalAreaString(trip.addresses[0])}}
</p>
</td>

<td style="padding-bottom: 0px;">
<!--<ng-container *ngIf="trip.people">
<p>{{peopleHelper.getPeopleNameString(trip.people)}} </p>
</ng-container>-->
<b>Tidskrav</b>
</td>
<td style="padding-bottom: 0px;">
<!-- TODO: Add seat description -->
<b>Status</b>
</td>
</tr>
</tbody>
</div>
</table>

<table>
<tbody class="col-md-12">
<tr *ngIf="lastNode">

<td style="padding-top: 0px;">
<p>{{tripHelper.getDateString(trip)}}</p>
</td>

<td style="padding-top: 0px;">
<i class="fa" aria-hidden="true" [ngClass]="tripHelper.getState(lastNode)" [ngStyle]="{'color':
tripHelper.getState(lastNode, true)}"></i>
</td>

<td style="padding-top: 0px;">
<p>{{ geographyHelper.getAddressString(trip.addresses[1]) }}, {{ geographyHelper.getPostalAreaString(trip.addresses[1])}}
</p>
</td>

<td style="padding-top: 0px;">
<!--<ng-container *ngIf="trip.people">
<p>{{peopleHelper.getPeopleNameString(trip.people)}} </p>
</ng-container>-->
<p>-</p>
</td>
<td style="padding-top: 0px;">
<!-- TODO: Add seat description -->
<p>{{tripHelper.getStateString(trip)}}</p>
</td>
</tr>
</tbody>
</table>

</div>

</div>
</div>

</div>

关于html - 如何让两个 Bootstrap 列彼此相邻,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49854627/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com