3tco Posted January 10, 2021 Share Posted January 10, 2021 Is there a way to create a custom header or paragraph style that I can apply globally to a word or sentence? Link to comment
tazmeah Posted January 11, 2021 Share Posted January 11, 2021 Sure. Here's an idea. Let's say the sentence in question is, "I like turtles." The code below will find all instances of this sentence in headers of any size and in paragraphs, regardless of capitalization, and color the text red while giving it a green background. Add it to your footer injection and any time you type this sentence, it should be red and green. <style> .turtles { color: red; background: green; } </style> <script> document.querySelectorAll("h1, h2, h3, h4, h5, h6, p").forEach(function(el){ el.innerHTML = el.innerHTML.replace(/i like turtles/gi, function(text){ return "<span class='turtles'>" + text + "</span>"; }) }) </script> Link to comment
3tco Posted January 13, 2021 Author Share Posted January 13, 2021 Thank you for the response. It appears that would require me to upgrade my account to a business account or above. I was hoping to accomplish this without this cost. Oh well. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.