This content originally appeared on Bram.us and was authored by Bramus!
One of my favorite features that shipped with Chrome 80 — apart from Optional Chaining — is the ability to link to text-fragments. By default Chrome will highlight those in yellow:
As tweeted before, coming to Chromium 89 is the ability to style those text-fragments using the ::target-text
pseudo-element.
? Coming to @googlechrome 89 is the ability to style the target text from text-fragment links using the ::target-text pseudo-element.#CSS pic.twitter.com/GkXfgDFjnT
— Bramus! (@bramus) January 31, 2021
This snippet below:
/* Style scroll-to-text fragments */
::target-text {
background: #00cdff;
}
Will visually manifest itself like this:
Cool! ?
~
Thank me with a coffee.
I don't do this for profit but a small one-time donation would surely put a smile on my face. Thanks!
To stay in the loop you can follow @bramus or follow @bramusblog on Twitter.
This content originally appeared on Bram.us and was authored by Bramus!
Bramus! | Sciencx (2021-02-15T22:15:03+00:00) Style the target text from text-fragment links using the ::target-text pseudo-element. Retrieved from https://www.scien.cx/2021/02/15/style-the-target-text-from-text-fragment-links-using-the-target-text-pseudo-element/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.