bulma/docs/documentation/layout/hero.html

416 lines
11 KiB
HTML
Raw Normal View History

---
2017-07-29 12:02:00 +00:00
title: Hero
2024-03-21 16:11:54 +00:00
layout: docs
theme: library
fullwidth: true
2018-04-10 10:45:48 +00:00
hide_categories: true
2018-04-18 16:00:00 +00:00
hide_fortyfour: true
doc-tab: layout
doc-subtab: hero
2018-04-09 15:50:33 +00:00
breadcrumb:
2024-03-21 16:11:54 +00:00
- home
- documentation
- layout
- layout-hero
2018-04-18 16:00:00 +00:00
meta:
colors: true
sizes: true
variables: true
---
2018-04-18 16:00:00 +00:00
<div class="content">
<p>
2024-03-21 16:11:54 +00:00
The hero component allows you to add a <strong>full width banner</strong> to your webpage, which can optionally
cover the full height of the page as well.
2018-04-18 16:00:00 +00:00
</p>
2024-03-21 16:11:54 +00:00
<p>The basic requirement of this component are:</p>
2018-04-18 16:00:00 +00:00
<ul>
<li>
<code>hero</code> as the main container
<ul>
2024-03-21 16:11:54 +00:00
<li><code>hero-body</code> as a direct child, in which you can put all your content</li>
2018-04-18 16:00:00 +00:00
</ul>
</li>
</ul>
<p>
2024-03-21 16:11:54 +00:00
For the <a href="#fullheight-hero">fullheight hero</a> to work, you will also need a <code>hero-head</code> and a
<code>hero-foot</code>.
2018-04-18 16:00:00 +00:00
</p>
</div>
{% capture hero_example %}
<section class="hero">
<div class="hero-body">
2024-03-21 16:11:54 +00:00
<p class="title">Hero title</p>
<p class="subtitle">Hero subtitle</p>
</div>
</section>
{% endcapture %}
2024-03-21 16:11:54 +00:00
{%
include docs/elements/snippet.html content=hero_example
horizontal=true fullwidth=true
%}
{%
include docs/elements/anchor.html
name="Colors"
%}
<div class="content">
2024-03-21 16:11:54 +00:00
As with buttons, you can choose one of the
<strong>8 different colors</strong>:
</div>
{% for color in site.data.colors.justColors %}
2024-03-21 16:11:54 +00:00
{% capture foobar %}
<section class="hero is-{{ color }}">
<div class="hero-body">
2024-03-21 16:11:54 +00:00
<p class="title">{{ color | capitalize }} hero</p>
<p class="subtitle">{{ color | capitalize }} subtitle</p>
</div>
</section>
{% endcapture %}
2024-03-21 16:11:54 +00:00
{%
include docs/elements/snippet.html content=foobar
horizontal=true fullwidth=true
%}
{% endfor %}
<!-- -->
2024-03-21 16:11:54 +00:00
{% include docs/elements/anchor.html name="Sizes" %}
<div class="content">
<p>
2024-03-21 16:11:54 +00:00
You can have even more imposing banners by using one of
<strong>5 different sizes</strong>:
</p>
<ul>
<li><code>is-small</code></li>
<li><code>is-medium</code></li>
<li><code>is-large</code></li>
<li><code>is-halfheight</code></li>
<li><code>is-fullheight</code></li>
</ul>
</div>
{% capture small_hero %}
<section class="hero is-small is-primary">
<div class="hero-body">
2024-03-21 16:11:54 +00:00
<p class="title">Small hero</p>
<p class="subtitle">Small subtitle</p>
</div>
</section>
{% endcapture %}
2024-03-21 16:11:54 +00:00
{%
include docs/elements/snippet.html content=small_hero
horizontal=true fullwidth=true
%}
{% capture medium_hero %}
<section class="hero is-medium is-link">
<div class="hero-body">
2024-03-21 16:11:54 +00:00
<p class="title">Medium hero</p>
<p class="subtitle">Medium subtitle</p>
</div>
</section>
{% endcapture %}
2024-03-21 16:11:54 +00:00
{%
include docs/elements/snippet.html content=medium_hero
horizontal=true fullwidth=true
%}
{% capture large_hero %}
<section class="hero is-large is-info">
<div class="hero-body">
2024-03-21 16:11:54 +00:00
<p class="title">Large hero</p>
<p class="subtitle">Large subtitle</p>
</div>
</section>
{% endcapture %}
2024-03-21 16:11:54 +00:00
{%
include docs/elements/snippet.html content=large_hero
horizontal=true fullwidth=true
%}
<div id="halfheight-hero"></div>
{% capture halfheight_example %}
<section class="hero is-success is-halfheight">
<div class="hero-body">
<div class="">
2024-03-21 16:11:54 +00:00
<p class="title">Half height hero</p>
<p class="subtitle">Half height subtitle</p>
</div>
</div>
</section>
{% endcapture %}
2024-03-21 16:11:54 +00:00
{%
include docs/elements/snippet.html
content=halfheight_example horizontal=true fullwidth=true
%}
<div id="fullheight-hero"></div>
{% capture fullheight_example %}
<section class="hero is-danger is-fullheight">
<div class="hero-body">
<div class="">
2024-03-21 16:11:54 +00:00
<p class="title">Fullheight hero</p>
<p class="subtitle">Fullheight subtitle</p>
</div>
</div>
</section>
{% endcapture %}
2024-03-21 16:11:54 +00:00
{%
include docs/elements/snippet.html
content=fullheight_example horizontal=true fullwidth=true
%}
<!-- Fullheight with navbar -->
2024-03-21 16:11:54 +00:00
{% include docs/elements/anchor.html name="Fullheight with navbar" %}
<div class="content">
<p>
2024-03-21 16:11:54 +00:00
If you are using a
<a href="{{ site.url }}/documentation/components/navbar/#fixed-navbar">fixed navbar</a>, you can use the
<code>is-fullheight-with-navbar</code> modifier on the hero for it to occupy the viewport height minus the navbar
height.
</p>
</div>
2024-03-21 16:11:54 +00:00
{% capture fullheight_with_navbar_example %} {% include
docs/examples/navbar-basic.html %}
<section class="hero is-link is-fullheight-with-navbar">
<div class="hero-body">
2024-03-21 16:11:54 +00:00
<p class="title">Fullheight hero with navbar</p>
</div>
</section>
{% endcapture %}
2024-03-21 16:11:54 +00:00
{%
include docs/elements/snippet.html
content=fullheight_with_navbar_example horizontal=true fullwidth=true
%}
<!-- Fullheight with 3 parts -->
2024-03-21 16:11:54 +00:00
{% include docs/elements/anchor.html name="Fullheight hero in 3 parts" %}
<div class="content">
2024-03-21 16:11:54 +00:00
<p>
To obtain a hero that will cover the whole height of the viewport, you can split it in
<strong>3 vertical parts</strong>:
</p>
<ul>
<li>
<code>hero</code>
<ul>
<li><code>hero-head</code> (always at the top)</li>
<li><code>hero-body</code> (always vertically centered)</li>
<li><code>hero-foot</code> (always at the bottom)</li>
</ul>
</li>
</ul>
</div>
2017-10-09 11:27:08 +00:00
{% capture heroNavbarA %}
<section class="hero is-primary is-medium">
2017-10-09 11:27:08 +00:00
<!-- Hero head: will stick at the top -->
<div class="hero-head">
2017-10-09 11:27:08 +00:00
<nav class="navbar">
<div class="container">
2017-10-09 11:27:08 +00:00
<div class="navbar-brand">
<a class="navbar-item">
2024-03-21 16:11:54 +00:00
<img src="{{ site.url }}/assets/images/bulma-type-white.png" alt="Logo" />
</a>
2020-12-09 15:44:40 +00:00
<span class="navbar-burger" data-target="navbarMenuHeroA">
2017-10-09 11:27:08 +00:00
<span></span>
<span></span>
<span></span>
2024-03-21 16:11:54 +00:00
<span></span>
2017-10-09 11:27:08 +00:00
</span>
</div>
2017-10-09 11:27:08 +00:00
<div id="navbarMenuHeroA" class="navbar-menu">
<div class="navbar-end">
2024-03-21 16:11:54 +00:00
<a class="navbar-item is-active"> Home </a>
<a class="navbar-item"> Examples </a>
<a class="navbar-item"> Documentation </a>
2017-10-09 11:27:08 +00:00
<span class="navbar-item">
<a class="button is-primary is-inverted">
<span class="icon">
2018-01-10 16:30:23 +00:00
<i class="fab fa-github"></i>
2017-10-09 11:27:08 +00:00
</span>
<span>Download</span>
</a>
</span>
</div>
</div>
</div>
2017-10-09 11:27:08 +00:00
</nav>
</div>
<!-- Hero content: will be in the middle -->
<div class="hero-body">
<div class="container has-text-centered">
2024-03-21 16:11:54 +00:00
<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>
2017-10-09 11:27:08 +00:00
{% endcapture %}
{% capture heroNavbarB %}
<section class="hero is-info is-large">
<div class="hero-head">
2017-10-09 11:27:08 +00:00
<nav class="navbar">
<div class="container">
2017-10-09 11:27:08 +00:00
<div class="navbar-brand">
<a class="navbar-item">
2024-03-21 16:11:54 +00:00
<img src="{{ site.url }}/assets/images/bulma-type-white.png" alt="Logo" />
</a>
2020-12-09 15:44:40 +00:00
<span class="navbar-burger" data-target="navbarMenuHeroB">
2017-10-09 11:27:08 +00:00
<span></span>
<span></span>
<span></span>
2024-03-21 16:11:54 +00:00
<span></span>
2017-10-09 11:27:08 +00:00
</span>
</div>
2017-10-09 11:27:08 +00:00
<div id="navbarMenuHeroB" class="navbar-menu">
<div class="navbar-end">
2024-03-21 16:11:54 +00:00
<a class="navbar-item is-active"> Home </a>
<a class="navbar-item"> Examples </a>
<a class="navbar-item"> Documentation </a>
2017-10-09 11:27:08 +00:00
<span class="navbar-item">
<a class="button is-info is-inverted">
<span class="icon">
2018-01-10 16:30:23 +00:00
<i class="fab fa-github"></i>
2017-10-09 11:27:08 +00:00
</span>
<span>Download</span>
</a>
</span>
</div>
</div>
</div>
2017-10-09 11:27:08 +00:00
</nav>
</div>
<div class="hero-body">
<div class="container has-text-centered">
2024-03-21 16:11:54 +00:00
<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>
2017-10-09 11:27:08 +00:00
<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>
2017-10-09 11:27:08 +00:00
{% endcapture %}
{% capture heroNavbarC %}
<section class="hero is-success is-fullheight">
2017-10-09 11:27:08 +00:00
<!-- Hero head: will stick at the top -->
<div class="hero-head">
2017-10-09 11:27:08 +00:00
<header class="navbar">
<div class="container">
2017-10-09 11:27:08 +00:00
<div class="navbar-brand">
<a class="navbar-item">
2024-03-21 16:11:54 +00:00
<img src="{{ site.url }}/assets/images/bulma-type-white.png" alt="Logo" />
</a>
2020-12-09 15:44:40 +00:00
<span class="navbar-burger" data-target="navbarMenuHeroC">
2017-10-09 11:27:08 +00:00
<span></span>
<span></span>
<span></span>
2024-03-21 16:11:54 +00:00
<span></span>
2017-10-09 11:27:08 +00:00
</span>
</div>
2017-10-09 11:27:08 +00:00
<div id="navbarMenuHeroC" class="navbar-menu">
<div class="navbar-end">
2024-03-21 16:11:54 +00:00
<a class="navbar-item is-active"> Home </a>
<a class="navbar-item"> Examples </a>
<a class="navbar-item"> Documentation </a>
2017-10-09 11:27:08 +00:00
<span class="navbar-item">
<a class="button is-success is-inverted">
<span class="icon">
2018-01-10 16:30:23 +00:00
<i class="fab fa-github"></i>
2017-10-09 11:27:08 +00:00
</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">
2024-03-21 16:11:54 +00:00
<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>
2017-10-09 11:27:08 +00:00
{% endcapture %}
2024-03-21 16:11:54 +00:00
{%
include docs/elements/snippet.html content=heroNavbarA
horizontal=true fullwidth=true more=true
%}
{%
include docs/elements/snippet.html content=heroNavbarB horizontal=true fullwidth=true
more=true
%}
{%
include docs/elements/snippet.html content=heroNavbarC
horizontal=true fullwidth=true more=true
%}