Change Text Selection Color

Change Text Selection Color code:

1.index.html:

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Selection Color</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div class="container"> <h1>Lorem ipsum dolor sit amet consectetur adipisicing elit.</h1> <p> Earum aliquam repellat velit asperiores. Dolore sunt ipsum amet nam fugit ipsam vitae dicta asperiores optio. Doloremque corporis non officiis atque maiores.</p> </div> </body> </html>

2.style.css:

body { margin: 0; padding: 0; font-family: Arial, Helvetica, sans-serif; } .container { width: 70%; margin: 0 auto; } h1::selection { background: gold; color: blue; } p::selection { background: red; color: gray; }

Оставьте комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *