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.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"> <script src = "https://code.jquery.com/jquery-1.11.3.min.js"></script> <script src = "https://code.jquery.com/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 文件打开为 http://localhost/five_column_grid.html,将显示以下输出。