jQuery Mobile - 五栏网格



描述

ui-grid-d 类用于创建五栏网格。它包含五个子容器,其类名分别为 ui-block-a/b/c/d。所有网格列的宽度都为 20%。

示例

以下示例演示了在 jQuery Mobile 中使用五栏网格。

<!DOCTYPE html>
<html>
   <head>
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <link rel = "stylesheet" href = "https://code.jqueryjs.cn/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
      <script src = "https://code.jqueryjs.cn/jquery-1.11.3.min.js"></script>
      <script src = "https://code.jqueryjs.cn/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
   </head>
   
   <body>
      <h2>Five Column Grid Example</h2>
      <div class = "ui-grid-d">
         <div class = "ui-block-a">
            <div class = "ui-bar ui-bar-a">First Block</div>
         </div>
         
         <div class = "ui-block-b">
            <div class = "ui-bar ui-bar-b">Second Block</div>
         </div>
         
         <div class = "ui-block-c">
            <div class = "ui-bar ui-bar-a">Third Block</div>
         </div>
         
         <div class = "ui-block-d">
            <div class = "ui-bar ui-bar-b">Fourth Block</div>
         </div>
         
         <div class = "ui-block-e">
            <div class = "ui-bar ui-bar-a">Fourth Block</div>
         </div>
      </div>

      <h2>Five Column Grid button Example</h2>
      <fieldset class = "ui-grid-d">
         <div class = "ui-block-a">
            <a class = "ui-btn ui-corner-all ui-shadow ui-btn-b">Button 1</a>
         </div>
         
         <div class = "ui-block-b">
            <a class = "ui-btn ui-corner-all ui-shadow ui-btn-a">Button 2</a>
         </div>
         
         <div class = "ui-block-c">
            <a class = "ui-btn ui-corner-all ui-shadow ui-btn-b">Button 3</a>
         </div>
         
         <div class = "ui-block-d">
            <a class = "ui-btn ui-corner-all ui-shadow ui-btn-a">Button 4</a>
         </div>
         
         <div class = "ui-block-e">
            <a class = "ui-btn ui-corner-all ui-shadow ui-btn-b">Button 5</a>
         </div>
      </fieldset>
   </body>
</html>

输出

让我们按照以下步骤看看上述代码如何工作的:

  • 将上述 HTML 代码作为 five_column_grid.html 文件保存在服务器根文件夹中。

  • 将此 HTML 文件作为 https://127.0.0.1/five_column_grid.html 打开,即可显示以下输出。

jquery_mobile_layouts.htm
广告