---
title: List with sticky section headings
tags: visual,intermediate
---
Creates a list with sticky headings for each section.
- Use `overflow-y: auto` to allow the list container (`
`) to overflow vertically.
- Set headings (`- `) `position` to `sticky` and apply `top: 0` to stick to the top of the container.
```html
- A
- Algeria
- Angola
- B
- Benin
- Botswana
- Burkina Faso
- Burundi
- C
- Cabo Verde
- Cameroon
- Central African Republic
- Chad
- Comoros
- Congo, Democratic Republic of the
- Congo, Republic of the
- Cote d'Ivoire
- D
- Djibouti
- E
- Egypt
- Equatorial Guinea
- Eritrea
- Eswatini (formerly Swaziland)
- Ethiopia
```
```css
.container {
display: grid;
place-items: center;
min-height: 400px;
}
.sticky-stack {
background: #37474f;
color: #fff;
margin: 0;
height: 320px;
border-radius: 1rem;
overflow-y: auto;
}
.sticky-stack dt {
position: sticky;
top: 0;
font-weight: bold;
background: #263238;
color: #cfd8dc;
padding: 0.25rem 1rem;
}
.sticky-stack dd {
margin: 0;
padding: 0.75rem 1rem;
}
.sticky-stack dd + dt {
margin-top: 1rem;
}
```