Bulma `hero is-fullheight` renders inconsistent mobile height; viewport units or content overflow suspected
0 reputation · 31 Oct 2025, 20:00 UTC
0 reputation · 31 Oct 2025, 20:00 UTC
A Bulma hero is-fullheight section can appear taller or shorter than expected on mobile devices, but the underlying cause is not always the hero class itself. The goal is to determine whether the discrepancy comes from viewport-height sizing or from hero-body content and padding before making changes.
Mobile browsers handle 100vh inconsistently when URL bars collapse or expand, and alternatives like dvh or safe-area environment variables introduce their own compatibility trade-offs. Bulma's Sass and CSS-variable surface also shifted around the 1.x release, so the installed version affects which custom properties are reliable.
Before optimizing, the layout needs to be measured rather than guessed: compare the rendered height of the hero element, the hero-body block, and the document scroll height under different mobile UI states. A fixed navbar or unusually tall content can further obscure whether the extra space originates from hero sizing or from inner overflow.
What is the most reliable way to isolate viewport-height sizing from hero-body padding and content overflow in a Bulma full-height hero on mobile? Should the diagnosis prioritize measuring computed heights across browser UI states, or first auditing the installed Bulma version for CSS-variable support? How can a fixed navbar be factored into the measurement without conflating its offset with the hero's own height?
33775 reputation · 01 Nov 2025, 04:39 UTC
Measure computed heights across mobile browser UI states first. Auditing the Bulma version for CSS-variable support is useful only if you plan to patch with custom properties; it does not change the diagnostic measurement itself.
.is-fullheight applies min-height: 100vh in Bulma.100vh can exceed the visible area.hero-body padding and inner content can push the hero taller than the viewport once min-height is satisfied.The mismatch is probably a combination of 100vh anchoring to the layout viewport rather than the visual viewport, plus hero-body padding that is not subtracted from the available height.
const hero = document.querySelector('.hero.is-fullheight');
const body = hero?.querySelector('.hero-body');
if (!hero) { console.error('Hero not found'); }
console.log('hero offsetHeight:', hero.offsetHeight);
console.log('hero computed height:', getComputedStyle(hero).height);
console.log('document scrollHeight:', document.documentElement.scrollHeight);
console.log('innerHeight:', window.innerHeight);
console.log('visualViewport height:', window.visualViewport?.height);
if (body) {
console.log('hero-body computed height:', getComputedStyle(body).height);
console.log('hero-body padding:', getComputedStyle(body).padding);
}
hero.offsetHeight against window.innerHeight and visualViewport.height in both URL-bar states. A difference that appears only after collapse points to viewport-unit sizing, not content.hero-body padding and content height; the overflow is coming from inside the hero.Measure the navbar separately so its offset is not confused with hero height:
const navbar = document.querySelector('.navbar.is-fixed-top') || document.querySelector('.navbar');
console.log('navbar offsetHeight:', navbar?.offsetHeight);
console.log('navbar bounding rect:', navbar?.getBoundingClientRect());
Because position: fixed removes the navbar from flow, subtract its height only when calculating remaining space for content. Do not subtract it from the hero's computed height. If the hero appears to start below the navbar, that offset is visual overlap, not hero height inflation.
If you plan to fix this with Bulma CSS variables rather than a unit override, confirm the installed version first. Bulma 0.9+ exposes custom properties more reliably; older versions may not define --hero-height. Check package.json or run:
getComputedStyle(document.documentElement).getPropertyValue('--hero-height')
An empty string means the variable is not available in your build.
Share your installed Bulma version only if you intend to use CSS variables for the fix. The height-isolation steps above work regardless of version.
dvh support varies by browser; Safari added it in version 15.4, so a fallback to 100vh may still be needed.Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.