Skip to content

Instantly share code, notes, and snippets.

@natzir
Created September 25, 2023 08:18
Show Gist options
  • Save natzir/d86fa1486bb7bfa8ce0847ddd522bb0d to your computer and use it in GitHub Desktop.
Save natzir/d86fa1486bb7bfa8ce0847ddd522bb0d to your computer and use it in GitHub Desktop.
Pseudo-Element Highlighter Bookmarklet
javascript:(function(){function injectStyle(){var style=document.createElement('style');style.type='text/css';style.innerHTML='*::before, *::after {background-color: rgba(255,0,0,0.3) !important;}';document.head.appendChild(style);}injectStyle();})();
@natzir
Copy link
Author

natzir commented Sep 25, 2023

This bookmarklet is designed to assist web developers and SEO specialists in visually identifying content added using the ::before and ::after CSS pseudo-elements. When activated, it applies a semi-transparent red background to the content of these pseudo-elements, highlighting them on the page without altering or duplicating the existing content. This is especially useful in light of Google's recommendation against adding meaningful content or symbols using these pseudo-elements, as such content is not part of the DOM and is ignored by Google Search during indexing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment