Home >Web Front-end >CSS Tutorial >How can I change the color of specific words in HTML text?
<p><p>In this example, the elements change the color of "January 30, 2011" to red (#ff0000) and "summer" to blue (#0000a0). <p>CSS Example (Using Classes):
<p> Enter the competition by January 30, 2011 and you could win up to $$$$ — including amazing summer trips!<p>Here, we define two CSS classes, .date and .season, and assign them to the respective elements. This approach provides greater flexibility and allows for easier maintenance of styles.
The above is the detailed content of How can I change the color of specific words in HTML text?. For more information, please follow other related articles on the PHP Chinese website!