---
title: "Discussion on \"How to Programmatically Highlight Text with the CSS Custom Highlight API\" | Hashnode"
description: "Discussion on \"How to Programmatically Highlight Text with the CSS Custom Highlight API\". You can highlight text in the browser by clicking and dragging through the desired text. And sometimes this works fine. But there are times when you’ll want to programmatically highlight some text in an HTML document.\nIn this article, I’ll discuss a ..."
url: "https://hashnode.com/posts/how-to-programmatically-highlight-text-with-the-css-custom-highlight-api/6787d62041c11049156708c3"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to Programmatically Highlight Text with the CSS Custom Highlight API](https://freecodecamp.org/news/how-to-programmatically-highlight-text-with-the-css-custom-highlight-api?utm_source=hashnode&utm_medium=feed)

You can highlight text in the browser by clicking and dragging through the desired text. And sometimes this works fine. But there are times when you’ll want to programmatically highlight some text in an HTML document. In this article, I’ll discuss a ...

Jan 15, 2025 · 9 min read · freecodecamp.org  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#css](https://hashnode.com/tag/css)
-   [#web-development](https://hashnode.com/tag/web-development)

## Written by

[Joe Attardi](https://hashnode.com/@joeattardi)

@joeattardi · Boston Area, MA, USA

  
[View profile](https://hashnode.com/@joeattardi)

Veteran Software Developer | Web & Front-End Expert | Author | Tech Writer | Blogger

Software developer since 2004. Web/front-end expert (HTML, CSS, JS). O'Reilly and Apress author. Freelance tech writer. Blogger. Bridging code and communication in tech.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
