Use this file to discover all available pages before exploring further.
Hequalizer works through a two-part contract: you mark HTML elements with a data-hequalizer attribute, then create a JavaScript instance using that same string as the handle. Hequalizer finds your elements, measures the tallest one, and writes the result as a CSS custom property — your stylesheet decides how to apply it.
A handle is a short identifier that connects a group of HTML elements to a single Hequalizer instance. Every element that shares a handle will be measured together and receive the same CSS variable value.
Add data-hequalizer="your-handle" to every element in the group:
index.html
<div class="cards"> <article class="card"> <h3 data-hequalizer="card-title">Short title</h3> <p>Card body content.</p> </article> <article class="card"> <h3 data-hequalizer="card-title">A much longer title that wraps to a second line</h3> <p>Card body content.</p> </article> <article class="card"> <h3 data-hequalizer="card-title">Medium length title</h3> <p>Card body content.</p> </article></div>
Handles must follow slug format: lowercase letters, numbers, and hyphens only. The constructor validates the handle against the regular expression /^[a-z0-9]+(?:-[a-z0-9]+)*$/ and throws an error if it does not match.
new Hequalizer('card-title'); // ✅ letters and hyphensnew Hequalizer('product-title-2'); // ✅ letters, numbers, and hyphensnew Hequalizer('hero'); // ✅ single wordnew Hequalizer('blog-card-description'); // ✅ multiple hyphen-separated segments
Each handle can only be used by one active instance at a time. If you try to create a second instance with the same handle, Hequalizer throws an error. Retrieve an existing instance with Hequalizer.getInstance('your-handle') or call instance.destroy() before reusing the handle.
Here is a full example equalizing card titles across a grid layout.
1
Add data-hequalizer attributes to your HTML
index.html
<div class="cards"> <article class="card"> <h3 data-hequalizer="card-title">Wireless Headphones</h3> <p>Premium audio with noise cancellation.</p> </article> <article class="card"> <h3 data-hequalizer="card-title">Portable Bluetooth Speaker with 360° Sound</h3> <p>Take your music anywhere.</p> </article> <article class="card"> <h3 data-hequalizer="card-title">Smart Home Hub</h3> <p>Control all your devices from one place.</p> </article></div>
2
Create a Hequalizer instance
main.js
window.addEventListener('DOMContentLoaded', () => { new Hequalizer('card-title', { cssVariable: '--card-title-height' });});
Each independent group of elements needs its own handle and its own Hequalizer instance. Handles within a page must be unique — two different groups must never share the same handle string.
index.html
<article class="product-card"> <h3 data-hequalizer="product-title">Short name</h3> <p data-hequalizer="product-description">Short description.</p></article><article class="product-card"> <h3 data-hequalizer="product-title">A much longer product name here</h3> <p data-hequalizer="product-description">A much longer description that wraps to multiple lines.</p></article>
main.js
const titles = new Hequalizer('product-title', { cssVariable: '--product-title-height'});const descriptions = new Hequalizer('product-description', { cssVariable: '--product-description-height'});
Each instance tracks only the elements belonging to its own handle. Changes in one group never affect the other.
Use descriptive, semantic handles that reflect the element’s role in the layout — for example feature-card-title, blog-post-excerpt, or testimonial-author. This makes multi-group setups easy to scan at a glance.