表格內容的對齊方式 (alignment of the content in table)


問題描述

表格內容的對齊方式 (alignment of the content in table)

我需要創建一個如下圖所示的表格。當我加載來自字典的字體真棒圖標時,對齊被寵壞了。我正在努力對齊,就像每列之間的空格和圖標分散,它們應該在操作列下。在此先感謝。

data = [
    {
    'date':'Nov 1',
    'name':"Bengaluru",
    'entities': 14,
    'details':'Lorem Ipsum , Lorem Ipsum',
    'actions':'fa fa‑envelope‑o'
},
{
  'date':'Nov 2',
  'name':"Hyderabad",
  'entities': 17,
  'details':'Lorem Ipsum,Lorem Ipsum, Ipsum',
  'actions':'fa fa‑envelope‑o'

},
{
  'date':'Nov 3',
  'name':"Chennai",
  'entities': 50,
  'details':'Lorem,Lorem Ipsum,Lorem Ipsum',
  'actions':'fa fa‑envelope‑o'

},
{
  'date':'Nov 4',
  'name':"Mumbai",
  'entities': 20,
  'details':'Lorem Ipsum,Lorem ,Lorem Ipsum',
  'actions':'fa fa‑envelope‑o,fa fa‑share‑alt,fa fa‑trash‑o,fa fa‑pencil'

},
{
  'date':'Nov 5',
  'name':"Kerala",
  'entities': 10,
  'details':'Lorem ,Lorem Ipsum,Lorem Ipsum',
  'actions':'fa fa‑envelope‑o,fa fa‑share‑alt,fa fa‑trash‑o,fa fa‑pencil'

},
{
  'date':'Nov 6',
  'name':"Bhopal",
  'entities': 4,
  'details':'Lorem sum, Ipsum,Lorem sum',
  'actions':'fa fa‑envelope‑o,fa fa‑share‑alt,fa fa‑trash‑o,fa fa‑pencil'

},
{
  'date':'Nov 7',
  'name':"Indore",
  'entities': 54,
  'details':'Lorem Ipsum,rem Ipsum,rem Ipsum',
  'actions':'fa fa‑envelope‑o,fa fa‑share‑alt,fa fa‑trash‑o,fa fa‑pencil'

},
{
  'date':'Nov 8',
  'name':"Thane",
  'entities': 1,
  'details':'Lorem Ipsum',
  'actions':'fa fa‑envelope‑o,fa fa‑share‑alt,fa fa‑trash‑o,fa fa‑pencil'

},
{
  'date':'Nov 9',
  'name':"Pune",
  'entities': 64,
  'details':'Lorem Ipsum,Lorem Ipsum,Pune',
  'actions':'fa fa‑envelope‑o,fa fa‑share‑alt,fa fa‑trash‑o,fa fa‑pencil'

},
{
  'date':'Nov 10',
  'name':"Kutch",
  'entities': 224,
  'details':'Lorem Ipsum,PrivateCircle,Lorem Ipsum',
  'actions':'fa fa‑envelope‑o,fa fa‑share‑alt,fa fa‑trash‑o,fa fa‑pencil'

},
{
  'date':'Nov 11',
  'name':"Bengaluru",
  'entities': 114,
  'details':'PrivateCircle,Lorem Ipsum,Lorem Ipsum',
  'actions':'fa fa‑envelope‑o,fa fa‑share‑alt,fa fa‑trash‑o,fa fa‑pencil'

},
{
  'date':'Nov 12',
  'name':"J&k",
  'entities': 214,
  'details':'Lorem Ipsum,PrivateCircle,Lorem Ipsum',
  'actions':'fa fa‑envelope‑o,fa fa‑share‑alt,fa fa‑trash‑o,fa fa‑pencil'

},
{
  'date':'Nov 13',
  'name':"Punjab",
  'entities': 134,
  'details':'Lorem PrivateCircle,Lorem Ipsum,Lorem Ipsum',
  'actions':'fa fa‑envelope‑o,fa fa‑share‑alt,fa fa‑trash‑o,fa fa‑pencil'

},
{
  'date':'Nov 14',
  'name':"Bengaluru",
  'entities': 144,
  'details':'Lorem Ipsum,Lorem Ipsum,LoPrivateCircleum',
  'actions':'fa fa‑envelope‑o,fa fa‑share‑alt,fa fa‑trash‑o,fa fa‑pencil'

},
{
  'date':'Nov 15',
  'name':"Kolkata",
  'entities': 154,
  'details':'Lorem Ipsum,LoPrivateCirclesum,Lorem Ipsum',
  'actions':'fa fa‑envelope‑o,fa fa‑share‑alt,fa fa‑trash‑o,fa fa‑pencil'

},
{
  'date':'Nov 16',
  'name':"Delhi",
  'entities': 164,
  'details':'Lorem Ipsum,PrivateCirclem,Lorem Ipsum',
  'actions':'fa fa‑envelope‑o,fa fa‑share‑alt,fa fa‑trash‑o,fa fa‑pencil'

},
{
  'date':'Nov 17',
  'name':"Mysuru",
  'entities': 14,
  'details':'PrivateCircle,Lorem Ipsum,Lorem Ipsum',
  'actions':'fa fa‑envelope‑o,fa fa‑share‑alt,fa fa‑trash‑o,fa fa‑pencil'

},
{
  'date':'Nov 19',
  'name':"Vizag",
  'entities': 154,
  'details':'Lorem Ipsum,Lorem Ipsum,PrivateCircle',
  'actions':'fa fa‑envelope‑o,fa fa‑share‑alt,fa fa‑trash‑o,fa fa‑pencil'

},
{
  'date':'Nov 12',
  'name':"Agra",
  'entities': 14,
  'details':'Lorem Ipsum,Pune,Lorem Ipsum',
  'actions':'fa fa‑envelope‑o,fa fa‑share‑alt,fa fa‑trash‑o,fa fa‑pencil'

}]
<div class="container‑fluid">
  <section class="row">
    <div class="col‑md‑9 col‑12 overflow‑auto scroll">
      <table class="table table‑hover">
        <tr>
          <th class="text">Date</th>
          <th class="text">List Name</th>
          <th class="text">No. of Entities</th>
          <th class="text">Actions</th>
          <th class="text"></th>

        </tr>
        <tbody>
          <tr *ngFor="let items of data">
            <td class="text‑dark font‑weight‑bold">{{ items.date }}</td>
            <td  class="text‑dark font‑weight‑bold">{{ items.name }}</td>
            <td  class="text‑dark font‑weight‑bold">{{ items.entities }}</td>

            <td *ngFor="let x of items.actions.split(',')"><i class="{{x}}"></i></td>
            <td>
              <button type="button" class="btn btn‑outline‑secondary" (click)="getdetails(items)">
                Details
              </button>
            </td>
          </tr>
        </tbody>
      </table>
    </div>

    <div class="col‑md‑3 col‑12 overflow‑auto scroll  ">
      <div class="alert alert‑dark"><span class="text">No description yet</span> &nbsp; <span class="font‑weight‑bold sidedivtext">+Add Description</span> </div>
      <p *ngFor="let str of s" class="text‑center text‑primary">{{str}}</p>
    </div>
  </section>
</div>

stackblitz 鏈接

Let me know if you still have issue.

(by PremPiyush Jain)

參考文件

  1. alignment of the content in table (CC BY‑SA 2.5/3.0/4.0)

#bootstrap-4 #css #Angular #html






相關問題

在不同選項卡上時如何隱藏特定選項卡 (How to hide specific tab when on different tab)

如何將引導程序 4 中的內容連續居中? (How to center in bootstrap 4 the content in a row?)

構建 JavaScript 時缺少模塊 (Missing Module When Building JavaScript)

React-Bootstrap 選項卡 defaultActiveKey 不隨 stateChange 改變 (React-Bootstrap Tabs defaultActiveKey is not changing with stateChange)

表格內容的對齊方式 (alignment of the content in table)

切換器圖標無法調整導航欄寬度 (Toggler icon does not working on adjusting the navbar width)

如何根據設備大小使用屏幕 (How to use the screens based on the device size)

如何在引導程序 4 中為 col 調整大小設置動畫? (How to animate col resize in bootstrap 4?)

html頁面Bootstrap頂部的白條 (White bar at top of html page Bootstrap)

如何從 reactstrap 輸入覆蓋表單控制類? (How can I override form-control class from a reactstrap input?)

文檔似乎沒有變化,但為什麼寬度在 Bootstrap 4 和 5 之間給出不同的圖像比例? (It seems to be no change in docs, but why does width give different image scale between Bootstrap 4 and 5?)

引導表拆分單元格 (Bootstrap table split cells)







留言討論