Within my static html file filled with text, numerous snippets are highlighted using the <mark>
tag. I am looking to incorporate a button that can toggle the weight of these marked text sections between bold and normal. This would create an effect where the highlighting can be turned on or off.
Is there a special method to achieve this by directly adjusting the style of the mark
css class?
For instance:
- HTML:
... Here is an <mark>key piece of information</mark> ...
- CSS class BEFORE pressing the button:
mark { font-weight: bold; }
- CSS class AFTER pressing the button:
mark { font-weight: normal; }
The purpose behind this feature is to give users the choice of viewing highlighted text or not. While I understand I could manually change the styling for each marked section, I am curious if there is a more direct approach available.