Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [HTML][CSS]#nav li:hover
Forum PHP.pl > Forum > Przedszkole
Mlodycompany
Witam. Mam kawałek kodu HTML:
  1. <div id="nav">
  2.   <ul>
  3.   <li id="link"><a href="#">Market</a></li>
  4.   <li id="link"><a href="#">Offers</a></li>
  5.   <li id="link"><a href="#">Inquiry</a></li>
  6.   <li id="link"><a href="#">Job Ranking</a></li>
  7.   <li id="link"><a href="#">Tutorials</a></li>
  8.   <li id="link"><a href="#">About</a></li>
  9.   </ul>
  10.   </div>


i kawałek stylu: [css]

#nav li { float:left; color: #FFF; background: #C43219 url(nav.gif) no-repeat 0px 0px; margin:0; padding:0 0 0 9px; }
#nav li:hover { background: #1995C2 url(nav.gif) no-repeat 0 -41px; color: #FFF;}



[css]

Problem polega na tym, że gdy najadę na link to powinno się zmieniać tło, no ale się nie zmienia. Czy ktoś wie jak to rozwiązać?
sebekzosw
To od przeglądarki zależy... zapewne testujesz to na IE ;> w Firefox i Operze jak testuje to wszystko jest OK
nevt
popatrz na swój kod, opuściłeś jeden znaczmik...

po pierwsze nie
#nav li { ... }
#nav li:hover { ... }

tylko
#nav ul li { ... }
#nav ul li:hover { ... }

po drugie błędem jest przypisanie kilku elementom tego samego id="link"
jeżeli już, to zamień id na klasę czyli <li class="link"> ...
i wtedy twój css przyjmie postać
li.link { ... }
li.link:hover { ... }
Mlodycompany
ani jedno ani drugie nie działa :/ testuje na operze
korek_a
skoro wszystkim działa a tobie nie to znaczy że błąd jest gdzie indzie a nie w tych dwóch liniach css
bo w ff ie i operze dział to tez musisz mieć błąd gdzie indzie

czyli żuci tego twojego css-a


no albo opcja 3 smile.gif twoja opera jest uszkodzona
Mlodycompany
dam wam cały kod cssa
  1.  
  2. /* project: internet market
  3.   design: luka cvrk (www.solucija.com) 
  4.   framework: Concept Nova (www.conceptnova.com) */
  5.    
  6. body { padding: 0; margin: 0; font: 0.7em Arial, sans-serif; line-height: 1.5em; background: #F0F0F0; color: #454545; }
  7. a { color: #0E4D8B; background: inherit; }
  8. a:hover { color: #000; background: inherit;}
  9. a.title { color: #B41A1A; background: #FFF; }
  10.  
  11. h1 { font: bold 2em Arial, Sans-Serif; letter-spacing: -1px; padding: 16px 0 0 8px; margin: 0; }
  12. h2 { margin: 0; padding: 0; font: normal 1.6em Arial, Sans-Serif; letter-spacing: -1px; }
  13. h1 a { color: #FFF; background: inherit; }
  14. h1 a, h2 a { text-decoration: none; }
  15. h1 a:hover, h2 a:hover { color: #BFE1ED; background: inherit; }
  16. h3 { font: 90% Arial, Sans-Serif; margin: 0 0 10px 0; padding: 0; color: #5f5f5f; background: #FFF; }
  17. p { margin: 0 0 0px 0; line-height: 1.5em; }
  18. form { margin: 0; }
  19. input.search { width: 199px; border: none; background: #FFF url(input.gif); padding: 4px; color: #808080; }
  20. input.submit { height: 24px; font-weight: bold; width: 53px; border: none; background: #D96855 url(button.gif); padding: 3px; color: #FFF; }
  21.  
  22. /* layout
  23.   ------ */
  24.  
  25. .content { 
  26.  margin: 10px auto;
  27.  width: 768px;
  28.  background: #FFF url(big_middle.gif) repeat-y;
  29.  color: #454545;
  30.  
  31. }
  32.  
  33. .logo { padding: 18px 0 0 3px; }
  34.  
  35. /* header */
  36. .header_top { background: #FEFEFE url(big_top.gif) no-repeat; color: #FFF; height: 15px; }
  37. .header { padding: 0px 10px 0 10px; }
  38. .header_bottom { clear: both; background: #FEFEFE url(big_bottom.gif) no-repeat; color: #FFF; height: 15px; }
  39.    
  40. /* navigation */
  41. #nav { width:100%; float:left; }
  42. #nav ul { margin:0; list-style:none; padding: 0; }
  43. #nav a, #nav strong, #nav span { float:left; display:block; color:#fff; padding: 7px 20px 4px 10px; background: #C43219 url(nav.gif) no-repeat 100% 0px; text-decoration:none; font-weight: bold; }
  44. #nav a { float:none; }
  45. #nav li { float:left; color: #FFF; background: #C43219 url(nav.gif) no-repeat 0px 0px; margin:0; padding:0 0 0 9px; }
  46. #nav li:hover { background: #1995C2 url(nav.gif) no-repeat 0 -41px; color: #FFF;}
  47. #nav #current { background: #1995C2 url(nav.gif) no-repeat 0 -41px; color: #FFF; }
  48. #nav #current a { background: #1995C2 url(nav.gif) no-repeat 100% -41px; padding:7px 20px 4px 11px; color:#FFF; }
  49. #nav a:hover { color:#BFE1ED; background: #C43219 url(nav.gif) no-repeat 100% 0px; }  
  50.  
  51.  
  52. .sf_left {
  53.  float: left;
  54.  width: 203px;
  55.  height: 77px;
  56.  background: #5BB2D1 url(logobg.gif) repeat-x; 
  57.  color: #FFF;
  58.  border-top: 1px solid #137DA2;
  59.  border-bottom: 1px solid #000;
  60.  padding: 10px 0 0px 7px;
  61. }
  62.  
  63. .sf_right {
  64.  width: 537px;
  65.  float: right;
  66. }
  67.  
  68. .sf_search {
  69.  clear: both;
  70.  background: #CA090D url(searchbg.gif) repeat-x bottom left; 
  71.  color: #FFE4E0;
  72.  border-top: 1px solid #AA1717;
  73.  border-bottom: 1px solid #000;
  74.  padding: 18px 0 17px 15px;
  75.  margin-top: -2px;
  76. }
  77.  
  78. .subheader {
  79.  padding: 8px;
  80.  background: #f0f0f0;
  81.  color: #808080;
  82. }
  83.  
  84. /* left side
  85.   --------- */
  86.  
  87. .left {
  88.  float: left;
  89.  width: 595px;
  90.  margin: 0 0 10px 0;
  91. }
  92.  
  93.  .box_top {
  94.   background: #F0F0F0 url(leftbox_top.gif) no-repeat;
  95.   color: #808080;
  96.   height: 40px;
  97.   width: 159px;
  98.  }
  99.  
  100.  .box_top h2 {
  101.   color: #808080;
  102.   background: inherit;
  103.   padding: 7px 0 0 5px;
  104.   margin: 0;
  105.  }
  106.  
  107.  .box {
  108.   border-left: 2px solid #F0F0F0;
  109.   border-right: 2px solid #F0F0F0;
  110.   padding: 0 4px 0 7px;
  111.   margin: 0;
  112.   width: 144px;
  113.   color: #595959;
  114.   background: #FFF;
  115.  }
  116.  
  117.  .box_bottom {
  118.   background: #FFF url(leftbox_bottom.gif) no-repeat;
  119.   color: #000;
  120.   height: 13px;
  121.   width: 160px;
  122.   margin: 0 0 7px 0;
  123.  }
  124.  
  125.   /* left and central column */
  126.   .left_side { float: left; width: 159px; padding: 0px 5px 8px 8px; }
  127.   .right_side { float: right; width: 405px; margin: 0 5px 0 0; text-align: justify; }
  128.   
  129.   .article { padding: 0 5px 0 0px; margin-bottom: 20px; }
  130.   
  131.  .grey_top { clear: both; width: 382px; background: #EDEDED url(grey_top.gif) no-repeat; color: #000; height: 5px; padding: 0; margin: 0px 0 0 6px; }
  132.  .grey { width: 362px; margin: 0 0 0 6px; padding: 10px; background: #EDEDED url(grey_bottom.gif) no-repeat bottom left; color: #808080; }
  133.   
  134.  .grey a {
  135.   color: #C83C3C;
  136.   background: inherit;
  137.   font-weight: bold;
  138.  }
  139.  
  140.  .grey a:hover {
  141.   color: #000;
  142.   background: #EDEDED;
  143.  }
  144.  
  145.  .highlight {
  146.   padding: 5px 3px 5px 3px;
  147.   margin: 0 0 3px 0;
  148.   border-bottom: 1px solid #ccc;
  149.  }
  150.  
  151.   
  152. /* right side
  153.   ---------- */
  154.   
  155. .right { float: right; width: 170px; margin: 0 0 10px 0;}
  156.   
  157. img { float: left; margin: 0 9px 3px 0; }
  158.  
  159. /* footer
  160.   ------ */
  161.  
  162. .footer { 
  163.  clear: both; 
  164.  text-align: center;
  165.  color: #808080;
  166.  background: #f0f0f0;
  167.  padding: 10px 0 5px 0;
  168.  border-top: 1px solid #eee;
  169. }
  170. .footer p { line-height: 2em; }
  171. .footer a { color: #4F4F4F; background: #f0f0f0; border-bottom: 1px dotted #808080; text-decoration: none; } 
  172.  
  173.  
  174.  
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.