How to Change the Background Color of Selected Para in HTML

  1. <!DOCTYPE html>  
  2. <html>  
  3. <head>  
  4. <style type="text/css">  
  5.   
  6.   
  7.   
  8. p.red::-moz-selection {  
  9.     background: #FFB7B7 none repeat scroll 0% 0%;  
  10.         background-color: #FFB7B7;  
  11.         background-image: none;  
  12.         background-repeat: repeat;  
  13.         background-attachment: scroll;  
  14.         background-position: 0% 0%;  
  15.         background-clip: border-box;  
  16.         background-origin: padding-box;  
  17.         background-size: auto auto;  
  18. }  
  19. p.green::-moz-selection {  
  20.     background: #A8D1FF none repeat scroll 0% 0%;  
  21.         background-color: #9966CC;  
  22.         background-image: none;  
  23.         background-repeat: repeat;  
  24.         background-attachment: scroll;  
  25.         background-position: 0% 0%;  
  26.         background-clip: border-box;  
  27.         background-origin: padding-box;  
  28.         background-size: auto auto;  
  29. }  
  30.   
  31.   
  32. </style>  
  33. </head>  
  34. <body>  
  35.   
  36.   
  37.   
  38. <h1>.Net Intro</h1>  
  39.   
  40.   
  41. <p class="red">Hello everyone in C# corner</p>  
  42.   
  43.   
  44. <p class="green">.NET is a framework that executes every program or application that build under CLR. The .NET framework is a software development framework from Microsoft. It provides a controlled programming environment where software can be developed, installed and executed on Windows-based operating systems or web based or mobile based</p>  
  45.   
  46.   
  47.   
  48.   
  49. </body>  
  50. </html>