php-按列对齐两个引导表?
作者:互联网
我目前正在使用bootstrap和laravel表单控件在下面创建这些表结构.我现在遇到的唯一问题是,我无法弄清楚如何从两个单独的表格中获取删除和编辑按钮以进行排列?随附的照片是现在的样子以及用于显示表格的代码.
@extends('layouts.app')
@section('content')
<div class="container">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="card">
<div class="card-header">Dashboard</div>
<div class="card-body">
@if (session('status'))
<div class="alert alert-success">
{{ session('status') }}
</div>
@endif
<a href="/incidents/create" class="btn btn-primary">Create Incident</a>
<a href="/servers/create" class="btn btn-primary">Create Server</a>
<h1></h1>
<h3>Your Incidents </h3>
@if($incidents)
<table class='table table-striped'>
<tr>
<th>Title</th>
<th></th>
<th></th>
</tr>
@foreach($incidents as $incident)
<tr>
<td><h4>{{$incident->title}} : <strong>{{$incident->status}}</strong></h4></td>
<td><a href="/incidents/edit/{{$incident->id}}" class="btn btn-success">Edit</a></td>
<td>
{!!Form::open(['action' => ['IncidentsController@destroy', $incident->id], 'method' => 'POST', 'class' => 'float-right'])!!}
{{Form::hidden('_method', 'DELETE') }}
{{Form::submit('Delete', ['class' => 'btn btn-danger'])}}
{!!Form::close() !!}
</td>
</tr>
@endforeach
</table>
@endif
<h3>Your Servers </h3>
@if($servers)
<table class='table table-striped'>
<tr>
<th>Server Names</th>
<th></th>
<th></th>
</tr>
@foreach($servers as $server)
<tr>
<td><h4>{{$server->name}}</h4></td>
<td><a href="/servers/edit/{{$server->id}}" class="btn btn-success">Edit</a></td>
<td>
{!!Form::open(['action' => ['ServerController@destroy', $server->id], 'method' => 'POST', 'class' => 'float-right'])!!}
{{Form::hidden('_method', 'DELETE') }}
{{Form::submit('Delete', ['class' => 'btn btn-danger'])}}
{!!Form::close() !!}
</td>
</tr>
@endforeach
</table>
@endif
</div>
</div>
</div>
</div>
</div>
@endsection
在此先感谢您,对我如何将两个不同表的列对齐的任何帮助将不胜感激!
解决方法:
我将使用Bootstrap 4 sizing utils在表标题列上设置定义的宽度…
<table class="table table-striped">
<tbody>
<tr>
<th class="w-50">Server Names</th>
<th class="w-25"></th>
<th class="w-25"></th>
</tr>
<tr>..</tr>
</tbody>
</table>
https://www.codeply.com/go/hKnKbWhhHh
但是,仍然不能保证td列的宽度不会根据其内容而改变.那只是使用单独的表的结果.
标签:laravel,bootstrap-4,css,php 来源: https://codeday.me/bug/20191025/1926103.html