Bulma - 分页



说明

分页组件提供跨多页的一系列相关链接。它包括以下元素 -

  • pagination-previouspagination-next - 这些元素可用于链接到上一页和下一页。

  • pagination-list - 它提供页面项的数量。

    • pagination-link - 它指定页码的数量。

    • pagination-ellipsis - 它用于指定范围选择器。

下面的示例演示了使用分页组件的上述元素 -

<!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>
      <script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
   </head>
   
   <body>
      <section class = "section">
         <div class = "container">
            <span class = "is-size-5">
               Pagination
            </span>
            <br>
            <br>
            
            <nav class = "pagination" role = "navigation" aria-label = "pagination">
               <a class = "pagination-previous">Previous</a>
               <a class = "pagination-next">Next page</a>
               <ul class = "pagination-list">
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 1">1</a>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 2">2</a>
                  </li>
                  <li>
                     <span class = "pagination-ellipsis">…</span>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 25">25</a>
                  </li>
                  <li>
                     <a class = "pagination-link is-current" aria-label = "Page 26" aria-current = "page">26</a>
                  </li>
                  <li>
                     <span class = "pagination-ellipsis">…</span>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 49">49</a>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 50">50</a>
                  </li>
               </ul>
            </nav>
            <br>
            <br>
            
            <span class = "is-size-5">
               Disabled link
            </span>
            <br>
            <br>
            
            <nav class = "pagination" role = "navigation" aria-label = "pagination">
               <a class = "pagination-previous" title = "This is the first page" disabled>Previous</a>
               <a class = "pagination-next">Next page</a>
               <ul class = "pagination-list">
                  <li>
                     <a class = "pagination-link is-current" aria-label = "Page 1" aria-current = "page">1</a>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 2">2</a>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 3">3</a>
                  </li>
               </ul>
            </nav>
            <br>
            <br>
            
            <span class = "is-size-5">
               Centered Pagination
            </span>
            <br>
            <br>
            
            <nav class = "pagination is-centered" role = "navigation" aria-label = "pagination">
               <a class = "pagination-previous">Previous</a>
               <a class = "pagination-next">Next page</a>
               <ul class = "pagination-list">
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 1">1</a>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 2">2</a>
                  </li>
                  <li>
                     <span class = "pagination-ellipsis">…</span>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 25">25</a>
                  </li>
                  <li>
                     <a class = "pagination-link is-current" aria-label = "Page 26" aria-current = "page">26</a>
                  </li>
                  <li>
                     <span class = "pagination-ellipsis">…</span>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 49">49</a>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 50">50</a>
                  </li>
               </ul>
            </nav>
            <br>
            <br>
            
            <span class = "is-size-5">
               Right Pagination
            </span>
            <br>
            <br>
            
            <nav class = "pagination is-right" role = "navigation" aria-label = "pagination">
               <a class = "pagination-previous">Previous</a>
               <a class = "pagination-next">Next page</a>
               <ul class = "pagination-list">
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 1">1</a>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 2">2</a>
                  </li>
                  <li>
                     <span class = "pagination-ellipsis">…</span>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 25">25</a>
                  </li>
                  <li>
                     <a class = "pagination-link is-current" aria-label = "Page 26" aria-current = "page">26</a>
                  </li>
                  <li>
                     <span class = "pagination-ellipsis">…</span>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 49">49</a>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 50">50</a>
                  </li>
               </ul>
            </nav>
            
         </div>
      </section>
   </body>
   
</html>

它显示以下输出 -

分页大小

你可以通过对pagination组件使用is-small, is-mediumis-large这3个修饰符来指定分页的大小。

以下示例介绍了如何以不同大小显示分页 -

<!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>
      <script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
   </head>
   
   <body>
      <section class = "section">
         <div class = "container">
            <span class = "title">
               Pagination Sizes
            </span>
            <br>
            <br>
            
            <span class = "is-size-5">
               Small Pagination
            </span>
            <br>
            <br>
            
            <nav class = "pagination is-centered is-small" role = "navigation" aria-label = "pagination">
               <a class = "pagination-previous">Previous</a>
               <a class = "pagination-next">Next</a>
               <ul class = "pagination-list">
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 1">1</a>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 2">2</a>
                  </li>
                  <li>
                     <span class = "pagination-ellipsis">…</span>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 25">25</a>
                  </li>
                  <li>
                     <a class = "pagination-link is-current" aria-label = "Page 26" aria-current = "page">26</a>
                  </li>
                  <li>
                     <span class = "pagination-ellipsis">…</span>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 49">49</a>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 50">50</a>
                  </li>
               </ul>
            </nav>
            <br>
            <br>
            
            <span class = "is-size-5">
               Medium Pagination
            </span>
            <br>
            <br>
            
            <nav class = "pagination is-centered is-medium" role = "navigation" aria-label = "pagination">
               <a class = "pagination-previous">Previous</a>
               <a class = "pagination-next">Next</a>
               <ul class = "pagination-list">
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 1">1</a>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 2">2</a>
                  </li>
                  <li>
                     <span class = "pagination-ellipsis">…</span>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 25">25</a>
                  </li>
                  <li>
                     <a class = "pagination-link is-current" aria-label = "Page 26" aria-current = "page">26</a>
                  </li>
                  <li>
                     <span class = "pagination-ellipsis">…</span>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 49">49</a>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 50">50</a>
                  </li>
               </ul>
            </nav>
            <br>
            <br>
            
            <span class = "is-size-5">
               Large Pagination
            </span>
            <br>
            <br>
            
            <nav class = "pagination is-centered is-large" role = "navigation" aria-label = "pagination">
               <a class = "pagination-previous">Previous</a>
               <a class = "pagination-next">Next</a>
               <ul class = "pagination-list">
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 1">1</a>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 2">2</a>
                  </li>
                  <li>
                     <span class = "pagination-ellipsis">…</span>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 25">25</a>
                  </li>
                  <li>
                     <a class = "pagination-link is-current" aria-label = "Page 26" aria-current = "page">26</a>
                  </li>
                  <li>
                     <span class = "pagination-ellipsis">…</span>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 49">49</a>
                  </li>
                  <li>
                     <a class = "pagination-link" aria-label = "Goto page 50">50</a>
                  </li>
               </ul>
            </nav>
         </div>
         
      </section>
   </body>
   
</html>

执行以上代码,你将获得以下输出 -

bulma_components.htm
广告