Bulma - 容器和级别
描述
Bulma 使用 容器 来表示基本布局元素并包装网站内容。容器 类在不同设备上的宽度值如下 −
桌面 的最大宽度为 960px。
宽屏 的最大宽度为 1152px。
全高清 的最大宽度为 1344px。
让我们创建一个 容器 类的简单示例 −
注意 −调整编码地面输出窗口的大小,以查看根据窗口大小发生的变化。
<!DOCTYPE html> <html> <head> <meta charset = "utf-8"> <meta name = "viewport" content = "width = device-width, initial-scale = 1"> <title>Bulma Container 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 = "title"> Container </span> <br> <br> <div class = "container"> <div class = "notification has-background-grey-lighter"> This container works on desktop. </div> </div> <br> <div class = "container is-fluid"> <div class = "notification has-background-grey-lighter"> This is <strong>fluid</strong> container, which has 32px gap on either side, on any viewport size. </div> </div> <br> <div class = "container is-widescreen"> <div class = "notification has-background-grey-lighter"> This is <strong>fullwidth</strong> container, works until <i>$widescreen</i> breakpoint. </div> </div> <br> <div class = "container is-fullhd"> <div class = "notification has-background-grey-lighter"> This is <strong>fullwidth</strong> container, works until <i>$fullhd</i> breakpoint. </div> </div> </div> </section> </body> </html>
它显示以下输出 −
级别
Bulma 包含水平级别,用于指定左侧和右侧的级别。level-left 类指定左侧的元素,level-right 类指定右侧的元素。您可以使用 level-item 类定义每个单独的元素。
级别包含两种类型的级别。
居中级别 − 您可以使项目在 level 容器中居中。
移动级别 −如果要在移动设备上水平显示项目,请在 level 容器中使用 is-mobile 修饰符。
让我们使用上述级别类型为 level 创建一个简单的示例,如下所示 −
注意 − 调整编码地面输出窗口的大小,以查看根据窗口大小发生的变化。
<!DOCTYPE html> <html> <head> <meta charset = "utf-8"> <meta name = "viewport" content = "width = device-width, initial-scale = 1"> <title>Bulma Container 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 = "title"> Level </span> <br> <br> <span class = "is-size-5">Level structure</span> <nav class = "level has-background-grey-lighter"> <div class = "level-left has-background-warning"> <p class = "level-item"><a>Menu 1</a></p> <p class = "level-item"><a>Menu 2</a></p> <p class = "level-item"><a>Menu 3</a></p> </div> <div class = "level-right has-background-warning"> <p class = "level-item"><a>Menu 1</a></p> <p class = "level-item"><a>Menu 2</a></p> <p class = "level-item"><a>Menu 3</a></p> </div> </nav> <span class = "is-size-5">Centered Level</span> <nav class = "level has-background-grey-lighter"> <div class = "level-item has-text-centered"> <p>Item-1</p> </div> <div class = "level-item has-text-centered"> <p>Item-2</p> </div> <div class = "level-item has-text-centered"> <p>Item-3</p> </div> <div class = "level-item has-text-centered"> <p>Item-4</p> </div> </nav> <span class = "is-size-5">Mobile Level</span> <nav class = "level has-background-grey-lighter is-mobile"> <div class = "level-item has-text-centered"> <p>Item-1</p> </div> <div class = "level-item has-text-centered"> <p>Item-2</p> </div> <div class = "level-item has-text-centered"> <p>Item-3</p> </div> <div class = "level-item has-text-centered"> <p>Item-4</p> </div> </nav> </div> </section> </body> </html>
它显示以下输出 −