All I know is a way to do something similar, and yet I’d need to have the same tag text on one dataset
, ai yes you could use a CSS selector by Attribute to pick up the text.
Here is an example, note that the first and last line have the text "blue", inside the tag <p>
and tb in the data-text
, with that I use the p[data-text*="blue" i]
to catch any mention of the text blue
(*
), high-cash independent (i
), and use as selector to apply the blue color.
p[data-text*="blue" i]{
color: blue;
}
<p data-text="Lorem ipsum dolor blue sit amet.">
Lorem ipsum dolor blue sit amet.
</p>
<p data-text="Lorem, ipsum dolor.">
Lorem, ipsum dolor.
</p>
<p data-text="Lorem ipsum dolor sit amet BLUE consectetur adipisicing elit. Id, nobis.">
Lorem ipsum dolor sit amet BLUE consectetur adipisicing elit. Id, nobis.
</p>
In short, if you have the floor blue
, within the text of data-text
, will apply the blue color to tag <p>
I don’t know if I understand your idea, but if you want to change the style of the specific paragraph "Hello world", just do
<p style="background-color:blue;">Ola mundo</p>
– Autovalor
Unfortunately it cannot be so, because I will assign this color dynamically if there is the world for example...
– Bruno Bafilli