- Bulma 教程
- Bulma - 主页
- Bulma - 简介
- Bulma - 概览
- Bulma - 修饰符
- Bulma - 列
- Bulma - 布局
- Bulma - 表单
- Bulma - 元素
- Bulma - 组件
- Bulma 有用资源
- Bulma - 快速指南
- Bulma - 资源
- Bulma - 讨论
Bulma - 容器和级别
描述
Bulma 使用容器来表示基本布局元素并封装网站内容。容器类在不同的设备上将具有以下宽度值 -
桌面的最大宽度为 960 像素。
宽屏的最大宽度为 1152 像素。
全高清的最大宽度为 1344 像素。
我们来创建容器类的一个简单示例 -
注意 - 调整编码基础输出窗口大小,以查看根据窗口大小发生的更改。
<!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>
它显示以下输出 -
bulma_layout.htm
广告