2.5 盒子容器

盒子是一个简单的容器,具有白色背景、一些填充和一个box阴影。

因为它充当容器,所以可以轻松地包含其他组件,如表单元素、媒体对象等,以下是三个简单的例子。

关于例子中的表单元素和媒体对象后面会有介绍,目前不需要掌握。


例子1、简单的盒子

I'm in a box.
<div class="box">
    I'm in a box.
</div>

例子2、包含表单元素

<form class="box">
    <div class="field">
      <label class="label">Email</label>
      <div class="control">
        <input class="input" type="email" placeholder="e.g. alex@example.com">
      </div>
    </div>
  
    <div class="field">
      <label class="label">Password</label>
      <div class="control">
        <input class="input" type="password" placeholder="********">
      </div>
    </div>
  
    <button class="button is-primary">Sign in</button>
  </form>


例子3、包含媒体对象

Image

John Smith @johnsmith 31m
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean efficitur sit amet massa fringilla egestas. Nullam condimentum luctus turpis.

<div class="box">
    <article class="media">
      <div class="media-left">
        <figure class="image is-64x64">
          <img src="https://bulma.io/images/placeholders/128x128.png" alt="Image">
        </figure>
      </div>
      <div class="media-content">
        <div class="content">
          <p>
            <strong>John Smith</strong> <small>@johnsmith</small> <small>31m</small>
            <br>
            Lorem ipsum dolor sit amet, consectetur adipiscing elit. 
Aenean efficitur sit amet massa fringilla egestas. 
Nullam condimentum luctus turpis.
          </p>
        </div>
        <nav class="level is-mobile">
          <div class="level-left">
            <a class="level-item" aria-label="reply">
              <span class="icon is-small">
                <i class="fas fa-reply" aria-hidden="true"></i>
              </span>
            </a>
            <a class="level-item" aria-label="retweet">
              <span class="icon is-small">
                <i class="fas fa-retweet" aria-hidden="true"></i>
              </span>
            </a>
            <a class="level-item" aria-label="like">
              <span class="icon is-small">
                <i class="fas fa-heart" aria-hidden="true"></i>
              </span>
            </a>
          </div>
        </nav>
      </div>
    </article>
  </div>


返回头部

问题反馈
返回顶部