英雄横幅(Hero)

展示某物的雄伟的英雄旗帜

hero横幅组件允许你在网页上添加一个全宽的横幅,也可以选择覆盖整个页面的高度。

该组件的基本要求是:

  • hero 主容器
    • hero-body 横幅内容,可以包含你所有的内容。

如果是全高横幅,你需要包含 hero-head 和a hero-foot

Example

横幅主标题

横幅副标题

HTML

<section class="hero">
<div class="hero-body">
  <p class="title">
  横幅主标题
  </p>
  <p class="subtitle">
  横幅副标题
  </p>
</div>
</section>

颜色 #

像按钮组件一样,你可以选择下面 8 种颜色之一:

Example

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>

Example

HTML

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

Example

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>

Example

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>

Example

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>

Example

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

Example

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>

Example

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>

Example

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>

Example

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>

Example

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 修饰符,使其占据减去导航栏高度的视口高度。

Example

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个垂直部分:

  • 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://bulma.io/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://bulma.io/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://bulma.io/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>

Variables #

Name
Type
Value
Computed Value
Computed Type
$hero-body-padding
size
3rem 1.5rem
$hero-body-padding-tablet
size
3rem 3rem
$hero-body-padding-small
size
1.5rem
$hero-body-padding-medium
size
9rem 4.5rem
$hero-body-padding-large
size
18rem 6rem
$hero-colors
variable
$colors
Bulma colors
map

返回头部

问题反馈
返回顶部