0

I have been learning about attribute selectors and using them occasionally, but what if I wanted to make a certain word highlighted, is this possible with attributes, or another way in pure CSS?

Here is the code:

body {
font-family: Verdana, sans-serif;
}
a[href="http://www.maine.gov"] {
    color: #006994;
  text-decoration:none;
}
p[*=|"COVID-19"] {
font-weight: 800;
color: #90181;
}
<p><a href="http://www.maine.gov">Maine.gov</a></p>
<p>Today in Maine, 243,000 COVID-19 cases were recorded.</p>
<p>New Hampshire attributed 2,487 cases of COVID-19 since the pandemic began.</p>

How could I highlight all cases of a certain word with the color I've used, in CSS? Is this not possible with pure HTML/CSS and attribute selectors?

The above is just an example page, to show some of the attributes.

avenas8808
  • 13
  • 3

0 Answers0