{"id":5028,"date":"2025-01-21T11:49:38","date_gmt":"2025-01-21T16:49:38","guid":{"rendered":"https:\/\/frontendmasters.com\/blog\/?p=5028"},"modified":"2025-01-21T11:50:08","modified_gmt":"2025-01-21T16:50:08","slug":"cool-people-link-to-text-fragments","status":"publish","type":"post","link":"https:\/\/frontendmasters.com\/blog\/cool-people-link-to-text-fragments\/","title":{"rendered":"Cool People Link to Text Fragments"},"content":{"rendered":"\n<p>Just in case you didn&#8217;t know, you don&#8217;t <em>need<\/em> a page to have ID&#8217;s on elements anymore in order to jump down to a particular place. We&#8217;ve reached support across all major browsers to <a href=\"https:\/\/frontendmasters.com\/courses\/#:~:text=Web%20Performance%20Fundamentals%2C%20v2\">link to Text Fragments<\/a>, like:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">https:\/\/frontendmasters.com\/courses\/#:~:text=Web%20Performance%20Fundamentals%2C%20v2<\/pre>\n\n\n\n<p>The <code>#:~:<\/code> syntax is kinda funky, but here we are, and it&#8217;s not too hard to get your hands on:<\/p>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>Chromium browsers have a&nbsp;<em>\u201cCopy Link to Highlight\u201d<\/em>&nbsp;option in the context menu when you right-click highlighted text.<\/p>\n<cite><a href=\"https:\/\/dbushell.com\/2024\/12\/05\/url-fragment-text-directives\/\">Cool People Link to Text Fragments<\/a> \u2014 David Bushell<\/cite><\/blockquote>\n\n\n\n<p>What I&#8217;m just learning is that y<a href=\"https:\/\/codepen.io\/chriscoyier\/pen\/GgKMrMP\">ou can <em>style<\/em> the selected fragment<\/a> (a little), just like you can with <code>:target<\/code>. I suppose <code>::target-text<\/code> is a pseudo-<strong>element<\/strong> because it&#8217;s selecting potentially a <em>part<\/em> of an element that doesn&#8217;t otherwise exist, but <code>:target<\/code> is a pseudo-<strong>class<\/strong> because it selects an entire element that does exist.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Just in case you didn&#8217;t know, you don&#8217;t need a page to have ID&#8217;s on elements anymore in order to jump down to a particular place. We&#8217;ve reached support across all major browsers to link to Text Fragments, like: https:\/\/frontendmasters.com\/courses\/#:~:text=Web%20Performance%20Fundamentals%2C%20v2 The #:~: syntax is kinda funky, but here we are, and it&#8217;s not too hard [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5029,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"sig_custom_text":"","sig_image_type":"featured-image","sig_custom_image":0,"sig_is_disabled":false,"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[29],"tags":[289,7,31,288],"class_list":["post-5028","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-the-beat","tag-target","tag-css","tag-html","tag-text-fragments"],"acf":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/frontendmasters.com\/blog\/wp-content\/uploads\/2025\/01\/copy-fragment.png?fit=1470%2C900&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/5028","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/comments?post=5028"}],"version-history":[{"count":2,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/5028\/revisions"}],"predecessor-version":[{"id":5031,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/posts\/5028\/revisions\/5031"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media\/5029"}],"wp:attachment":[{"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/media?parent=5028"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/categories?post=5028"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/frontendmasters.com\/blog\/wp-json\/wp\/v2\/tags?post=5028"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}