Posted By

gamblelyn on 05/31/11


css html

Versions (?)

nav sprites

 / Published in: HTML

sprite is 300px x 300px

/REVIEW OF POSITIONING: The first value is the horizontal position and the second value is the vertical. The top left corner is 0 0. Units can be pixels (0px 0px) or any other CSS units. If you only specify one value, the other value will be 50%. You can mix % and positions/

  1. /*---css--- sprite is 300px x 300px with 100px by 100px shapes*/
  3. #nav{position: relative; top: 15px; max-height: 120px; left: -25px;}
  5. #nav ul {display: block; max-height: 100px;}
  7. #nav ul li { font-family: 'Arial Black', sans-serif; font-size: 15px;
  8. letter-spacing: 3px; text-decoration: none; text-transform: capitalize; line-height: 20px; text-align:center; }
  10. #nav ul li a {display: block; color: #fff; width: 100px; height: 100px; background: url("images/homepagenavsprite.png") no-repeat; float: left;
  11. }
  12. #nav ul li a span{display: block; margin-top: 35px; margin-left: 18px;}
  14. #nav li.home a, #nav li.home a:link, #nav li.home a:visited {background-position: 0 0; outline:0; }
  15. #nav li.home a:hover {background-position: 0 -100px;}
  16. #nav li.home a:focus, a:active {background-position: 0 -200px;border: none; outline:0;}
  18. #nav a, #nav a:link, #nav a:visited {background-position:0 0; }
  19. #nav a:hover {background-position: 0px -100px;}
  20. #nav a:focus, a:active {background-position: 0 -200px;border: none; outline:0;}
  22. #nav a, #nav a:link, #nav a:visited {background-position:0 0; }
  23. #nav a:hover {background-position: 0px -100px;}
  24. #nav a:focus, a:active {background-position: 0 -200px; border: none; outline:0;}
  26. ------------html
  28. <div id="nav">
  29. <ul id="navsprite">
  30. <li class="home"><a href="#"><span>About</span></a></li>
  31. <li class="work"><a href="#"><span>Work</span></a></li>
  32. <li class="blog"><a href="#"><span>Blog</span></a></li>
  33. </ul>
  34. </div>

Report this snippet  

You need to login to post a comment.