惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Last Week in AI
Last Week in AI
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
博客园_首页
雷峰网
雷峰网
IT之家
IT之家
I
InfoQ
酷 壳 – CoolShell
酷 壳 – CoolShell
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
B
Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 【当耐特】
大猫的无限游戏
大猫的无限游戏
博客园 - 聂微东
Hugging Face - Blog
Hugging Face - Blog
A
About on SuperTechFans
月光博客
月光博客
P
Proofpoint News Feed
博客园 - 三生石上(FineUI控件)
J
Java Code Geeks
G
Google Developers Blog
小众软件
小众软件
宝玉的分享
宝玉的分享
Jina AI
Jina AI
V
Visual Studio Blog

Stefan Judis Web Development

Web Weekly #199 Web Weekly #198 Web Weekly #197 Michelle Barker on Stage Fright Web Weekly #196 Escape from Average Web Weekly #195 Web Weekly #194 Web Weekly #193 Web Weekly #192 Web Weekly #191 Web Weekly #190 Web Weekly #189 Web Weekly #188 Intl can localize units, too! The scope of type guards and assertion functions Web Weekly #187 Web Weekly #186 Web Weekly #185 New lines are removed from WHATWG URLs Web Weekly #184 Nobody owes you anything How to scale elements and their layout with CSS "zoom" Notes on relying on the ARIA Authoring Practices Guide Web Weekly #183 Web Weekly #182 Web Weekly #181 Web Weekly #180 ARIA roles can remove their children’s semantics Clean up your Mac with open source
How to style the found search / "find in page" ...
Stefan Judis · 2026-02-02 · via Stefan Judis Web Development

Published at

Updated at

Reading time
2min

This post is part of my Today I learned series in which I share all my web development learnings.

Chrome 144 shipped new CSS pseudo-elements!

::search-text {
  background: var(--blue);
  color: white;
}

::search-text:current {
  background: var(--blue-darker);
  color: white;
  text-decoration: currentColor solid underline;
}

The classes are so new that there aren't MDN pages yet, but I'm super excited about this tiny search improvement.

I'm pretty quick with hitting CMD + F because often I can't be bothered with using the provided site search (if there is one). However, sometimes it's hard to understand what's currently selected if you're looking at multiple matching substrings.

Today I learned, this is a Chrome/Firefox problem because Safari's "find in page" feature adds an overlay while highlighting the current substring.

Find in page in Safari showing highlights for all matching strings while marking the currently selected one.

This looks great, but I won't switch browsers for a better in-page search experience. So what about Chrome and Firefox?

::search-text allows you to style the found strings to follow your site's style. This is good stuff but not really helping with understanding the currently selected search string. This is where ::search-text:current comes into play. Check this out!

Hit "CMD + F" and search for "doggo"!

Doggo ipsum heckin good boys and girls ruff floofs. Doggo such treat smol you are doin me a concern blop wow such tempt stop it fren, puggo stop it fren wow very biscit borkdrive. Aqua doggo pupperino much ruin diet borkdrive heckin good boys...

If you're on Chrome 144 right now, search the page for "doggo"! The matching strings in the component above are matching my site's colors and you can now see which dog is the selected search entry. It doesn't look as fancy as the Safari overlay but I'll buy it!

Find in page highlighting all strings in blue and the currently matching one in black.

Highlighting "find in page" entries isn't the most groundbreaking feature in the world, but I'm excited because I think it'll make my search experience way better! Apparently, there's no clear thumbs up from Mozilla yet, but let's hope that we'll get this improvement on the web.

If you want to dive deeper, here are some more resources:

If you enjoyed this article...

Join 6.5k readers and learn something new every week with Web Weekly.

Stefan standing in the park in front of a green background

Related Topics

Related Articles