Skip to content

Instantly share code, notes, and snippets.

Created September 25, 2023 08:18
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
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();})();
Copy link

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