【问题标题】:How can I make a beautiful table view on a website page ? Laravel如何在网站页面上制作漂亮的表格视图?拉拉维尔
【发布时间】:2021-04-02 04:44:46
【问题描述】:

需要帮助设计网站页面上的文字,我显示表格的数据,它们看起来不太好(附截图)帮助 我的视图文件:

@extends('layouts.layout')
@section('title')Бізнес@endsection
@section ('main_content')
    <h1>Бизнес</h1>
    <p>
    @foreach ($business as $singleBusiness)
        <li>{{ $singleBusiness->id}}</li>>
        <li>{{ $singleBusiness->name}}</li>>
        <li>{{ $singleBusiness->mail}}</li>>
        <li>{{ $singleBusiness->website}}</li>>
        @endforeach
        </p>
@endsection

my plate looks like this, all records are vertical(

【问题讨论】:

  • 你的帖子有很多问题;您说“表格视图”,但您使用的是&lt;p&gt;&lt;li&gt; 元素,这不是&lt;table&gt;...您还有双&gt;&gt;,它正在输出&gt;...查看 HTML 表格的文档并尝试使用:w3schools.com/html/html_tables.asp(或 Google 搜索“HTML 表格”等)

标签: laravel laravel-blade laravel-8 laravel-datatables


【解决方案1】:

所以,laravel 自带引导程序,所以你可以使用它。这是获得一张好桌子的最简单方法

你可以从这个页面获取tabel html,然后把你的数据放进去

https://getbootstrap.com/docs/4.5/content/tables/

类似这样的东西

<table class="table">
    <thead>
      <tr>
        <th scope="col">#</th>
        <th scope="col">name</th>
        <th scope="col">mail</th>
        <th scope="col">website</th>
      </tr>
    </thead>
    <tbody>
        @foreach ($business as $singleBusiness)
        <tr>
            <th scope="row">{{ $singleBusiness->id}}</th>
            <td>{{ $singleBusiness->name}}</td>
            <td>{{ $singleBusiness->mail}}</td>
            <td>{{ $singleBusiness->website}}</td>
      </tr>
      @endforeach
    </tbody>
</table>

【讨论】:

  • 非常感谢
猜你喜欢
  • 2016-03-03
  • 2019-06-09
  • 2018-10-01
  • 2016-07-20
  • 2015-03-16
  • 2023-01-30
  • 2015-03-28
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多