---
title: Templates
date: 2026-06-12T22:26:00+01:00
author: John Henry Donovan
canonical_url: "https://johnhenry.ie/plugins/matrix-block-anchor/docs/guide/templates"
section: Plugins
---
esc

↑↓ to navigate↵ to selectesc to close

Menu On this page 

- [Return to top](#)

Documentation

Documentation

# Templates

In a typical Matrix page builder setup, use the field handle directly as your ID value:

```twig
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8" id="{{ block.yourFieldHandle }}">
```

Note: Replace `yourFieldHandle` with the actual handle of your Matrix Block Anchor field.

## Sticky Header

Clicking an anchor link scrolls the page, and if the linked element ends up near the top, it can get hidden under a sticky header.

To stop that happening, set scroll-padding in your CSS:

```css
html,
body {
    scroll-padding-top: 100px; /* set to the height of your header */
}
```

On this page
