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

推荐订阅源

Google DeepMind News
Google DeepMind News
Attack and Defense Labs
Attack and Defense Labs
S
Security Affairs
P
Palo Alto Networks Blog
Webroot Blog
Webroot Blog
P
Privacy International News Feed
H
Hacker News: Front Page
www.infosecurity-magazine.com
www.infosecurity-magazine.com
C
Cybersecurity and Infrastructure Security Agency CISA
Recent Commits to openclaw:main
Recent Commits to openclaw:main
T
The Blog of Author Tim Ferriss
T
Threat Research - Cisco Blogs
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Spread Privacy
Spread Privacy
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Schneier on Security
Schneier on Security
Jina AI
Jina AI
Simon Willison's Weblog
Simon Willison's Weblog
Scott Helme
Scott Helme
A
About on SuperTechFans
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Recorded Future
Recorded Future
F
Fortinet All Blogs
PCI Perspectives
PCI Perspectives
Google DeepMind News
Google DeepMind News
T
Troy Hunt's Blog
MyScale Blog
MyScale Blog
I
InfoQ
F
Full Disclosure
宝玉的分享
宝玉的分享
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Security Archives - TechRepublic
Security Archives - TechRepublic
Latest news
Latest news
W
WeLiveSecurity
月光博客
月光博客
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
N
Netflix TechBlog - Medium
量子位
P
Proofpoint News Feed
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
GbyAI
GbyAI
SecWiki News
SecWiki News
AI
AI
The Last Watchdog
The Last Watchdog
Hacker News - Newest:
Hacker News - Newest: "LLM"
G
GRAHAM CLULEY
N
News and Events Feed by Topic
K
Kaspersky official blog
V2EX - 技术
V2EX - 技术

博客园 - xgqfrms

xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs Remotion Video Maker All In One git worktree All In One Tesla 的车机使用什么技术来渲染汽车模型的? 宜家 VEVELSTAD 维维斯托床架 All In One macOS sysmond bug All In One Three.js All In One The COF of LCD Monitor All In One Dell 显示器 S2419HM 灰屏 &花屏 All In One AI Harness Engineering All In One 电脑外接显示器天梯榜 All In One How to change the speed display unit of GSP from mph to km/h using GoPro Labs All In One WHCA 白宫记者协会 All In One Pascal Editor All In One 主流犬种图解指南 All In One 泡沫喷雾 & 辣椒喷雾 All In One 如何给身份证照片添加水印 All In One GoPro MISSION 1 PRO price All In One 杭州历史天气数据 All In One Pandoc All In One GoPro MISSION 1 SERIES All In One GoPro telemetry 中的 GPS5 与 GPS9 是什么 All In One xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs xgqfrms, cnblogs, blogs OpenCode All In One OpenClaw 设置 cron 定时任务 All In One free MongoDB Cloud API All In One 如何在 Raspberry Pi 安装 OpenClaw All In One free cloud LLM models API All In One Claude Code Free Video Tutorials All In One 如何解决 OpenClaw 升级后导致 feishu plugin 无法使用的问题 All In One Claude Code skills & plugins All In One LLM Benchmark All In One How to fix use the FileZilla FTP upload file error All In One
xgqfrms, cnblogs, blogs
xgqfrms · 2026-04-02 · via 博客园 - xgqfrms

CSS Custom Highlight API All In One

CSS 自定义高亮 API

MDN

const parentNode = document.getElementById("foo");

// step 1: 创建 range object
const range1 = new Range();
range1.setStart(parentNode, 10);
range1.setEnd(parentNode, 20);

const range2 = new Range();
range2.setStart(parentNode, 40);
range2.setEnd(parentNode, 60);

// step 2: 创建 highlight object
const highlight = new Highlight(range1, range2);

// step 3:  注册 highlight object
CSS.highlights.set("user-1-highlight", highlight);

/* step 4: 使用 ::highlight 为元素 ,高亮 highlight object  */
::highlight(user-1-highlight) {
  background-color: yellow;
  color: black;
}

image

https://developer.mozilla.org/en-US/docs/Web/API/CSS_Custom_Highlight_API

https://developer.mozilla.org/en-US/docs/Web/API/Highlight

https://developer.mozilla.org/en-US/docs/Web/API/CSS/highlights_static

demos

::highlight(search-results) {
          background-color: #ff0066;
          color: white;
}

css-highlight-api

https://codepen.io/xgqfrms/pen/yyajErb

refs

https://x.com/KaraBharat/status/2039362336792986075?s=20



©xgqfrms 2012-2021

www.cnblogs.com/xgqfrms 发布文章使用:只允许注册用户才可以访问!

原创文章,版权所有©️xgqfrms, 禁止转载 🈲️,侵权必究⚠️!