Introduction

Here I am going to use the technique to add a nice rollover effect to UL lists so the user can easily home in on a particular list item just by rolling the mouse over it. This animation uses CSS3, which works in IE10+, FF, Chrome, and Safari.
Implementation
CSS code
Put this CSS code in the head section:
  1. <style>
  2. ul.animatedbgul {
  3. margin: 0;
  4. padding: 0;
  5. list-style: none;
  6. }
  7. ul.animatedbgul li {
  8. width: 100%;
  9. clear: left;
  10. /* clear contents of inner span, which will be floated left */
  11. overflow: hidden;
  12. /* clear contents of an inner span, which will be floated left */
  13. }
  14. ul.animatedbgul li span {
  15. display: block;
  16. float: left;
  17. /* cause width of each span to take up only as much space as needed */
  18. min-width: 0px;
  19. /* animated property. Explicit min-width defined so animation works. */
  20. margin-bottom: 5px;
  21. padding: 8px;
  22. color: #5d5d5d;
  23. }
  24. ul.animatedbgul li:hover span {
  25. color: #fff;
  26. background: #ce3e3e;
  27. border-left: 8px solid darkred;
  28. min-width: 450px;
  29. /* animated property. Set to desired final length of background */
  30. -webkit-box-shadow: 0 0 5px gray;
  31. -moz-box-shadow: 0 0 5px gray;
  32. box-shadow: 0 0 5px gray;
  33. -webkit-transition: all 0.3s ease-out;
  34. -moz-transition: all 0.3s ease-out;
  35. -o-transition: all 0.3s ease-out;
  36. transition: all 0.3s ease-out;
  37. }
  38. </style>
Html code
Place this HTML code in body section:
  1. <ul class="animatedbgul">
  2. <li><span>Java</span></li>
  3. <li><span>Python</span></li>
  4. <li><span>Clarion</span></li>
  5. <li><span>Clipper</span></li>
  6. </ul>