大横幅(Hero)

用来展示东西的令人印象深刻的大横幅(hero banner)

大横幅组件允许您为网页添加全宽度横幅——也可以占满页面高度。

该组件基本需求是:

  • hero 是主容器
    • hero-body 是可放置所有内容的直接子级

如果想使用全高度横幅,您需要一个 hero-head 和一个 hero-foot

示例

Hero title

Hero subtitle

HTML

<section class="hero">
  <div class="hero-body">
    <p class="title">
      Hero title
    </p>
    <p class="subtitle">
      Hero subtitle
    </p>
  </div>
</section>

颜色 #

如同按钮一样,您可以选择 8 不同颜色之一:

示例

Primary hero

Primary subtitle

HTML

<section class="hero is-primary">
  <div class="hero-body">
    <p class="title">
      Primary hero
    </p>
    <p class="subtitle">
      Primary subtitle
    </p>
  </div>
</section>

示例

HTML

<section class="hero is-link">
  <div class="hero-body">
    <p class="title">
      Link hero
    </p>
    <p class="subtitle">
      Link subtitle
    </p>
  </div>
</section>

示例

Info hero

Info subtitle

HTML

<section class="hero is-info">
  <div class="hero-body">
    <p class="title">
      Info hero
    </p>
    <p class="subtitle">
      Info subtitle
    </p>
  </div>
</section>

示例

Success hero

Success subtitle

HTML

<section class="hero is-success">
  <div class="hero-body">
    <p class="title">
      Success hero
    </p>
    <p class="subtitle">
      Success subtitle
    </p>
  </div>
</section>

示例

Warning hero

Warning subtitle

HTML

<section class="hero is-warning">
  <div class="hero-body">
    <p class="title">
      Warning hero
    </p>
    <p class="subtitle">
      Warning subtitle
    </p>
  </div>
</section>

示例

Danger hero

Danger subtitle

HTML

<section class="hero is-danger">
  <div class="hero-body">
    <p class="title">
      Danger hero
    </p>
    <p class="subtitle">
      Danger subtitle
    </p>
  </div>
</section>

型号 #

您通过使用 5 种不同型号之一可能会获得非同凡响的效果:

  • is-small
  • is-medium
  • is-large
  • is-halfheight
  • is-fullheight

示例

Small hero

Small subtitle

HTML

<section class="hero is-small is-primary">
  <div class="hero-body">
    <p class="title">
      Small hero
    </p>
    <p class="subtitle">
      Small subtitle
    </p>
  </div>
</section>

示例

HTML

<section class="hero is-medium is-link">
  <div class="hero-body">
    <p class="title">
      Medium hero
    </p>
    <p class="subtitle">
      Medium subtitle
    </p>
  </div>
</section>

示例

Large hero

Large subtitle

HTML

<section class="hero is-large is-info">
  <div class="hero-body">
    <p class="title">
      Large hero
    </p>
    <p class="subtitle">
      Large subtitle
    </p>
  </div>
</section>

示例

Half height hero

Half height subtitle

HTML

<section class="hero is-success is-halfheight">
  <div class="hero-body">
    <div class="">
      <p class="title">
        Half height hero
      </p>
      <p class="subtitle">
        Half height subtitle
      </p>
    </div>
  </div>
</section>

示例

Fullheight hero

Fullheight subtitle

HTML

<section class="hero is-danger is-fullheight">
  <div class="hero-body">
    <div class="">
      <p class="title">
        Fullheight hero
      </p>
      <p class="subtitle">
        Fullheight subtitle
      </p>
    </div>
  </div>
</section>

带导航条的全高度横幅 #

如果您使用固定导航条,您在横幅上可以使用 is-fullheight-with-navbar 修饰符,这样您就可以让横幅占据的高度为整个高度减调导航条的高度。

示例

HTML

<nav class="navbar">
  <div class="container">
    <div id="navMenu" class="navbar-menu">
      <div class="navbar-start">
        <a class="navbar-item">
          Home
        </a>
        <a class="navbar-item">
          Documentation
        </a>
      </div>

      <div class="navbar-end">
        <div class="navbar-item">
          <div class="buttons">
            <a class="button is-dark">Github</a>
            <a class="button is-link">Download</a>
          </div>
        </div>
      </div>
    </div>
  </div>
</nav>

<section class="hero is-link is-fullheight-with-navbar">
  <div class="hero-body">
    <p class="title">
      Fullheight hero with navbar
    </p>
  </div>
</section>

全高度横幅的 3 部分 #

覆盖整个视口高度的横幅可以分为 3 垂直部分

  • hero
    • hero-head(总在顶部)
    • hero-body(总在垂直中间部分)
    • hero-foot(总在底部)

HTML

<section class="hero is-primary is-medium">
  <!-- Hero head: will stick at the top -->
  <div class="hero-head">
    <nav class="navbar">
      <div class="container">
        <div class="navbar-brand">
          <a class="navbar-item">
            <img src="https://docs.rubyist.cn/bulma/images/bulma-type-white.png" alt="Logo">
          </a>
          <span class="navbar-burger" data-target="navbarMenuHeroA">
            <span></span>
            <span></span>
            <span></span>
          </span>
        </div>
        <div id="navbarMenuHeroA" class="navbar-menu">
          <div class="navbar-end">
            <a class="navbar-item is-active">
              Home
            </a>
            <a class="navbar-item">
              Examples
            </a>
            <a class="navbar-item">
              Documentation
            </a>
            <span class="navbar-item">
              <a class="button is-primary is-inverted">
                <span class="icon">
                  <i class="fab fa-github"></i>
                </span>
                <span>Download</span>
              </a>
            </span>
          </div>
        </div>
      </div>
    </nav>
  </div>

  <!-- Hero content: will be in the middle -->
  <div class="hero-body">
    <div class="container has-text-centered">
      <p class="title">
        Title
      </p>
      <p class="subtitle">
        Subtitle
      </p>
    </div>
  </div>

  <!-- Hero footer: will stick at the bottom -->
  <div class="hero-foot">
    <nav class="tabs">
      <div class="container">
        <ul>
          <li class="is-active"><a>Overview</a></li>
          <li><a>Modifiers</a></li>
          <li><a>Grid</a></li>
          <li><a>Elements</a></li>
          <li><a>Components</a></li>
          <li><a>Layout</a></li>
        </ul>
      </div>
    </nav>
  </div>
</section>

HTML

<section class="hero is-info is-large">
  <div class="hero-head">
    <nav class="navbar">
      <div class="container">
        <div class="navbar-brand">
          <a class="navbar-item">
            <img src="https://docs.rubyist.cn/bulma/images/bulma-type-white.png" alt="Logo">
          </a>
          <span class="navbar-burger" data-target="navbarMenuHeroB">
            <span></span>
            <span></span>
            <span></span>
          </span>
        </div>
        <div id="navbarMenuHeroB" class="navbar-menu">
          <div class="navbar-end">
            <a class="navbar-item is-active">
              Home
            </a>
            <a class="navbar-item">
              Examples
            </a>
            <a class="navbar-item">
              Documentation
            </a>
            <span class="navbar-item">
              <a class="button is-info is-inverted">
                <span class="icon">
                  <i class="fab fa-github"></i>
                </span>
                <span>Download</span>
              </a>
            </span>
          </div>
        </div>
      </div>
    </nav>
  </div>

  <div class="hero-body">
    <div class="container has-text-centered">
      <p class="title">
        Title
      </p>
      <p class="subtitle">
        Subtitle
      </p>
    </div>
  </div>

  <div class="hero-foot">
    <nav class="tabs is-boxed is-fullwidth">
      <div class="container">
        <ul>
          <li class="is-active">
            <a>Overview</a>
          </li>
          <li>
            <a>Modifiers</a>
          </li>
          <li>
            <a>Grid</a>
          </li>
          <li>
            <a>Elements</a>
          </li>
          <li>
            <a>Components</a>
          </li>
          <li>
            <a>Layout</a>
          </li>
        </ul>
      </div>
    </nav>
  </div>
</section>

HTML

<section class="hero is-success is-fullheight">
  <!-- Hero head: will stick at the top -->
  <div class="hero-head">
    <header class="navbar">
      <div class="container">
        <div class="navbar-brand">
          <a class="navbar-item">
            <img src="https://docs.rubyist.cn/bulma/images/bulma-type-white.png" alt="Logo">
          </a>
          <span class="navbar-burger" data-target="navbarMenuHeroC">
            <span></span>
            <span></span>
            <span></span>
          </span>
        </div>
        <div id="navbarMenuHeroC" class="navbar-menu">
          <div class="navbar-end">
            <a class="navbar-item is-active">
              Home
            </a>
            <a class="navbar-item">
              Examples
            </a>
            <a class="navbar-item">
              Documentation
            </a>
            <span class="navbar-item">
              <a class="button is-success is-inverted">
                <span class="icon">
                  <i class="fab fa-github"></i>
                </span>
                <span>Download</span>
              </a>
            </span>
          </div>
        </div>
      </div>
    </header>
  </div>

  <!-- Hero content: will be in the middle -->
  <div class="hero-body">
    <div class="container has-text-centered">
      <p class="title">
        Title
      </p>
      <p class="subtitle">
        Subtitle
      </p>
    </div>
  </div>

  <!-- Hero footer: will stick at the bottom -->
  <div class="hero-foot">
    <nav class="tabs is-boxed is-fullwidth">
      <div class="container">
        <ul>
          <li class="is-active"><a>Overview</a></li>
          <li><a>Modifiers</a></li>
          <li><a>Grid</a></li>
          <li><a>Elements</a></li>
          <li><a>Components</a></li>
          <li><a>Layout</a></li>
        </ul>
      </div>
    </nav>
  </div>
</section>

Made with Bulma 此页面为开放源码页面。 发现排版问题?或者表达模糊?
在 GitHub 改进该页内容

#native_company# #native_desc#
#native_cta#

简讯 功能、版本、展柜……实时新闻滚动发布!