File size: 957 Bytes
746d2f1
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
---
title: How do I create an anchor link?
slug: /knowledge-base/using-streamlit/create-anchor-link
---

# How do I create an anchor link?

## Overview

Have you wanted to create anchors so that users of your app can directly navigate to specific sections by specifying `#anchor` in the URL? If so, let's find out how.

## Solution

Anchors are automatically added to header text.

For example, if you define a header text via the [st.header()](/develop/api-reference/text/st.header) command as follows:

```python
st.header("Section 1")
```

Then you can create a link to this header using:

```python
st.markdown("[Section 1](#section-1)")
```

## Examples

- Demo app: [https://dataprofessor-streamlit-anchor-app-80kk8w.streamlit.app/](https://dataprofessor-streamlit-anchor-app-80kk8w.streamlit.app/)
- GitHub repo: [https://github.com/dataprofessor/streamlit/blob/main/anchor_app.py](https://github.com/dataprofessor/streamlit/blob/main/anchor_app.py)