bulma/docs/documentation/layout/hero.html
Jeremy Thomas 08ef4df2c0
Bulma v9 website (#3249)
* Add Bulma v9

* Add vendor dependencies

* Fix native

* Fix sponsors

* Add style attribute
2021-01-27 23:30:42 +00:00

447 lines
11 KiB
HTML

---
title: Hero
layout: documentation
fullwidth: true
hide_categories: true
hide_fortyfour: true
doc-tab: layout
doc-subtab: hero
breadcrumb:
- home
- documentation
- layout
- layout-hero
meta:
colors: true
sizes: true
variables: true
---
<div class="content">
<p>
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.
</p>
<p>
The basic requirement of this component are:
</p>
<ul>
<li>
<code>hero</code> as the main container
<ul>
<li>
<code>hero-body</code> as a direct child, in which you can put all your content
</li>
</ul>
</li>
</ul>
<p>
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>.
</p>
</div>
{% capture hero_example %}
<section class="hero">
<div class="hero-body">
<p class="title">
Hero title
</p>
<p class="subtitle">
Hero subtitle
</p>
</div>
</section>
{% endcapture %}
{% include elements/snippet.html content=hero_example horizontal=true fullwidth=true %}
{% include elements/anchor.html name="Colors" %}
<div class="content">
As with buttons, you can choose one of the <strong>8 different colors</strong>:
</div>
{% for color in site.data.colors.justColors %}
{% capture foobar %}
<section class="hero is-{{ color }}">
<div class="hero-body">
<p class="title">
{{ color | capitalize }} hero
</p>
<p class="subtitle">
{{ color | capitalize }} subtitle
</p>
</div>
</section>
{% endcapture %}
{% include elements/snippet.html content=foobar horizontal=true fullwidth=true %}
{% endfor %}
<!-- -->
{% include elements/anchor.html name="Sizes" %}
<div class="content">
<p>
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">
<p class="title">
Small hero
</p>
<p class="subtitle">
Small subtitle
</p>
</div>
</section>
{% endcapture %}
{% include elements/snippet.html content=small_hero horizontal=true fullwidth=true %}
{% capture medium_hero %}
<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>
{% endcapture %}
{% include elements/snippet.html content=medium_hero horizontal=true fullwidth=true %}
{% capture large_hero %}
<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>
{% endcapture %}
{% include 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="">
<p class="title">
Half height hero
</p>
<p class="subtitle">
Half height subtitle
</p>
</div>
</div>
</section>
{% endcapture %}
{% include 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="">
<p class="title">
Fullheight hero
</p>
<p class="subtitle">
Fullheight subtitle
</p>
</div>
</div>
</section>
{% endcapture %}
{% include elements/snippet.html content=fullheight_example horizontal=true fullwidth=true %}
<!-- Fullheight with navbar -->
{% include elements/anchor.html name="Fullheight with navbar" %}
<div class="content">
<p>
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>
{% capture fullheight_with_navbar_example %}
{% include examples/navbar-basic.html %}
<section class="hero is-link is-fullheight-with-navbar">
<div class="hero-body">
<p class="title">
Fullheight hero with navbar
</p>
</div>
</section>
{% endcapture %}
{% include elements/snippet.html content=fullheight_with_navbar_example horizontal=true fullwidth=true %}
<!-- Fullheight with 3 parts -->
{% include elements/anchor.html name="Fullheight hero in 3 parts" %}
<div class="content">
<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>
{% capture heroNavbarA %}
<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="{{ site.url }}/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>
{% endcapture %}
{% capture heroNavbarB %}
<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="{{ site.url }}/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>
{% endcapture %}
{% capture heroNavbarC %}
<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="{{ site.url }}/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>
{% endcapture %}
{% include elements/snippet.html content=heroNavbarA horizontal=true fullwidth=true more=true %}
{% include elements/snippet.html content=heroNavbarB horizontal=true fullwidth=true more=true %}
{% include elements/snippet.html content=heroNavbarC horizontal=true fullwidth=true more=true %}
{% include components/variables.html type='component' hide_content=true %}