https://www.w3schools.com/howto/tryit.asp?filename=tryhow_css_text_selection <!DOCTYPE html> <html> <head> <style> ::-moz-selection { /* Code for Firefox */ color: red; background: yellow; } ::selection { color: red; background: yellow; } </style> </head> <body> <h1>Select some text on this page:</h1> <p>This is a paragraph.</p> <div>This is some text in a div element.</div> <p><strong>Note:</strong> ::selection is not supported in Internet Explorer 8 and earlier versions.</p> <p><strong>Note:</strong> Firefox supports an alternative, the ::-moz-selection property.</p> </body> </html> |