Bulma教程

Bulma 表

说明

Bulma 包装了用于以表格格式显示数据的元素。您需要将 .table 类的基类添加到具有下表元素的 <table>-
标签和说明
<table>
它是一个主要的容器,它包装元素以表格格式显示数据。
<thead>
它是表格的顶部,包含表格标题行的元素。
<tbody>
它包含表格主体中表格行(<tr>)的元素。
<tr>
它指定出现在单行上的一组表格单元格(<td> 或 <td>)。
<th>
它定义表格单元格的标题。
<td>
这是一个默认的表格单元格。
<tfoot>
它是表格的底部。

基本表

如果您想在页面中显示基本表格样式,则将 .table 的基类添加到任何表格中,如下例所示-
<!DOCTYPE html>
<html>
   <head>
      <meta charset = "utf-8">
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <title>Bulma Elements Example</title>
      <link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css">
      <script src = "https://use.fontawesome.com/releases/v5.1.0/js/all.js"></script>
   </head>
   <body>
      <section class = "section">
         <div class = "container">
            <span class = "is-size-5">
               Basic Table
            </span>
            <br>
            
            <table class = "table">
               <thead>
                  <tr>
                     <th>Position</th>
                     <th>Name</th>
                     <th>Country</th>
                  </tr>
               </thead>
               <tfoot>
                  <tr>
                     <th><abbr title = "Position">Pos</abbr></th>
                     <th>Player</th>
                     <th>
                        <abbr title = "Played for the country">Country</abbr>
                     </th>
                  </tr>
               </tfoot>
               <tbody>
                  <tr>
                     <td>1</td>
                     <td>Sachin</td>
                     <td>India</td>
                  </tr>
                  <tr>
                     <td>2</td>
                     <td>Smith</td>
                     <td>Australia</td>
                  </tr>
                  <tr>
                     <td>3</td>
                     <td>Joe Root</td>
                     <td>England</td>
                  </tr>
               </tbody>
            </table>
            
         </div>
      </section>
      
   </body>
</html>
它显示以下输出-

修饰符

Bulma 支持以下修饰符以不同样式显示表格。
有边框 条纹 是窄的 可悬停 is-fullwidth
我们将采用上面的示例,并在 .table 类中使用所需的修饰符。在这里,我们将看到下表中 is-bordered 修饰符的用法,如下所示。
<!DOCTYPE html>
<html>
   <head>
      <meta charset = "utf-8">
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <title>Bulma Elements Example</title>
      <link rel = "stylesheet" href = "https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css">
      <script src = "https://use.fontawesome.com/releases/v5.1.0/js/all.js"></script>
   </head>
   
   <body>
      <section class = "section">
         <div class = "container">
            <span class = "is-size-5">
               Bordered Table
            </span>
            <br>
            
            <table class = "table is-bordered">
               <thead>
                  <tr>
                     <th>Position</th>
                     <th>Name</th>
                     <th>Country</th>
                  </tr>
               </thead>
               
               <tfoot>
                  <tr>
                     <th>
                        <abbr title = "Position">Pos</abbr>
                     </th>
                     <th>Player</th>
                     <th>
                        <abbr title = "Played for the country">Country</abbr>
                     </th>
                  </tr>
               </tfoot>
               
               <tbody>
                  <tr>
                     <td>1</td>
                     <td>Sachin</td>
                     <td>India</td>
                  </tr>
                  <tr>
                     <td>2</td>
                     <td>Smith</td>
                     <td>Australia</td>
                  </tr>
                  <tr>
                     <td>3</td>
                     <td>Joe Root</td>
                     <td>England</td>
                  </tr>
               </tbody>
            </table>
            
         </div>
      </section>
      
   </body>
</html>
它显示以下输出-
要使用其他修饰符,只需将上面使用的修饰符替换为表中的其他修饰符即可。
昵称: 邮箱:
Copyright © 2022 立地货 All Rights Reserved.
备案号:京ICP备14037608号-4