Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [HTML][CSS]Problem ze sprite'm...
czernin
post
Post #1





Grupa: Zarejestrowani
Postów: 62
Pomógł: 0
Dołączył: 14.06.2012

Ostrzeżenie: (0%)
-----


Witajcie!

Mam problem ze sprite. Kod css:

Kod
#container li {
    background: url(sprite.png) no-repeat top left;
}

.a{ background-position: 0 0; width: 200px; height: 75px; }
.a:hover{ background-position: 0 -76px; width: 200px; height: 75px; }
.b{ background-position: 0 -152px; width: 200px; height: 75px; }
.b:hover{ background-position: 0 -228px; width: 200px; height: 75px; }
.c{ background-position: 0 -304px; width: 200px; height: 75px; }
.c:hover{ background-position: 0 -380px; width: 200px; height: 75px; }
.d{ background-position: 0 -456px; width: 200px; height: 75px; }
.d:hover{ background-position: 0 -532px; width: 200px; height: 75px; }


Kod html:

  1. <title>Test menu</title>
  2. <link rel="stylesheet" type="text/css" href="style.css">
  3. </head>
  4. <a href="/" class="a"></a>
  5. <a href="gry.php" class="b"></a>
  6. <a href="dodaj.php" class="c"></a>
  7. <a href="kontakt.php" class="d"></a>
  8. </body>
  9. </html>


I to nie chce działać... Chodzi o to, żeby był efekt jak pod linkiem podanym niżej (po najechaniu na obrazek zostaje on zmieniony)

Kod
http://gry.xaa.pl/menu/efekt.php


Obrazek sprite:

Kod
http://gry.xaa.pl/menu/sprite.png


Dlaczego to nie chce działać? Może mi to ktoś wytłumaczyć?

Ten post edytował czernin 16.09.2012, 18:31:50
Go to the top of the page
+Quote Post
untorched
post
Post #2





Grupa: Zarejestrowani
Postów: 318
Pomógł: 76
Dołączył: 27.12.2011
Skąd: Dąbrowa Górnicza

Ostrzeżenie: (0%)
-----


http://www.w3schools.com/css/css_image_sprites.asp
Go to the top of the page
+Quote Post
Damonsson
post
Post #3





Grupa: Zarejestrowani
Postów: 2 355
Pomógł: 533
Dołączył: 15.01.2010
Skąd: Bydgoszcz

Ostrzeżenie: (0%)
-----


Zapomniałeś, że musi być elementem blokowym.

Dodaj:
  1. #container li {
  2. background: url(sprite.png) no-repeat top left;
  3. float: left;
  4. }
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 13:10