Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 4th, 2012  |  syntax: None  |  size: 1.46 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. CSS: background-position not working
  2. <div id="topnav">
  3.   <ul>
  4.     <li id="nav-home"><a href="index.html">Feature Product<span></span></a></li>
  5.     <li id="nav-all"><a href="shop_owners.html">All Products<span></span></a></li>
  6.     <li id="nav-how"><a href="all_products.html">How It Works<span></span></a></li>
  7.   </ul>
  8. </div>
  9.        
  10. #topnav {
  11.   position: relative;
  12.   left: 150px;
  13.   top: 100px;
  14.   margin: 0;
  15.   padding: 0;
  16.   height: 50px;
  17. }
  18.  
  19. #topnav ul {
  20.   list-style-type: none;
  21.   text-align: center;
  22.   line-height: 50px;
  23. }
  24.  
  25. #topnav ul li {
  26.   float: left;
  27. }
  28.  
  29. #topnav ul li a {
  30.   background: url(../nav-bar-2.png);
  31.   background-repeat: no-repeat;
  32.   display: block;
  33.   height: 50px;
  34.   position: relative;
  35. }
  36.  
  37. #nav-home {
  38.   width: 200px;
  39. }
  40.  
  41. #nav-all {
  42.   width: 200px;
  43.   background-position: -200 0px
  44. }
  45.  
  46. #nav-how {
  47.   width: 200px;
  48.   background-position: -400px 0px
  49. }
  50.  
  51. #topnav ul li a span {
  52.   background: url(../nav-bar-2.png) no-repeat scroll bottom left;
  53.   display: none;
  54.   position: absolute;
  55.   top: 0;
  56.   left: 0;
  57.   height: 50px;
  58.   width: 100%;
  59.   z-index: 100;
  60. }
  61.  
  62. #topnav li a span:hover {
  63.   cursor: pointer;
  64. }
  65.  
  66. #nav-home span {
  67.   background-position: 0px -50px
  68. }
  69.  
  70. #nav-all span {
  71.   background-position: -200 -50px;
  72. }
  73.  
  74. #nav-how span {
  75.   background-position: -400 -50px;
  76. }
  77.        
  78. #nav-home{width:200px;}
  79. #nav-all{width:200px; background-position:-200 0px}
  80. #nav-how{width:200px; background-position:-400px 0px}
  81.        
  82. #topnav ul li {background:url(../nav-bar-2.png); // a was removed from end of list