Hero
An imposing hero banner to showcase something
The hero component allows you to add a full width banner to your webpage, which can optionally cover the full height of the page as well.
The basic requirement of this component are:
heroas the main containerhero-bodyas a direct child, in which you can put all your content
For the fullheight hero to work, you will also need a hero-head and a hero-foot.
Hero title
Hero subtitle
<template>
<section class="hero">
<div class="hero-body">
<div class="container">
<h1 class="title">
Hero title
</h1>
<h2 class="subtitle">
Hero subtitle
</h2>
</div>
</div>
</section>
</template>
Color
As with buttons, you can choose one of the 7 different colors:
is-primaryis-white, is-black, is-light,
is-dark, is-primary, is-info, is-success,
is-warning, is-dangerPrimary title
Primary subtitle
<template>
<section class="hero is-primary">
<div class="hero-body">
<div class="container">
<h1 class="title">
Primary title
</h1>
<h2 class="subtitle">
Primary subtitle
</h2>
</div>
</div>
</section>
</template>
Gradients
By adding the
is-bold modifier, you can generate a subtle gradientPrimary title
Primary subtitle
<template>
<section class="hero is-primary is-bold">
<div class="hero-body">
<div class="container">
<h1 class="title">
Primary title
</h1>
<h2 class="subtitle">
Primary subtitle
</h2>
</div>
</div>
</section>
</template>
Sizes
You can have even more imposing banners by using one of 3 different sizes:
- small
- medium
- large
- fullheight
Medium title
Medium subtitle
<template>
<section class="hero is-primary is-medium">
<div class="hero-body">
<div class="container">
<h1 class="title">
Medium title
</h1>
<h2 class="subtitle">
Medium subtitle
</h2>
</div>
</div>
</section>
</template>
Fullheight with navbar
If you are using a fixed navbar,
you can use the
is-fullheight-with-navbar modifier on the hero for it to occupy the viewport height minus the navbar height.
<template>
<section>
<nav class="navbar">
<div class="container">
<div 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>
<div class="hero is-mix is-fullheight-with-navbar">
<div class="hero-body">
<div class="container">
<p class="title">Fullheight hero with navbar</p>
</div>
</div>
</div>
</section>
</template>
Fullheight hero in 3 parts
To obtain a hero that will cover the whole height of the viewport, you can split it in 3 vertical parts:
herohero-head(always at the top)hero-body(always vertically centered)hero-foot(always at the bottom)
Title
Subtitle
<template>
<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 is-size-4">
Buval
</a>
<span class="navbar-burger 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">
<h1 class="title">
Title
</h1>
<h2 class="subtitle">
Subtitle
</h2>
</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>
</template>