HTML CSS examples for CSS Widget:Hover to change Color
CSS hover over one paragraph and change background of the previous paragraph
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style id="compiled-css" type="text/css"> p:nth-of-type(3):hover + p { color:Chartreuse; } p:nth-of-type(2):hover~p:nth-of-type(4) { color:yellow; } p:first-of-type:hover~p { color:blue; } </style> <!--from w w w . j a v a2 s .c o m--> </head> <body> <div class="app"> <p>Lorem ipsum dolor</p> <p>Lorem ipsum dolor s</p> <p>Lorem ipsum dolor </p> <p>Lorem ipsum dolor</p> </div> <p>Lorem ipsum dolor sit </p> </body> </html>