Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][CSS]Buttony
gniew1971
post
Post #1





Grupa: Zarejestrowani
Postów: 97
Pomógł: 0
Dołączył: 18.12.2008

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


Zrobiłem sobie w photoshopie buttony, jest ich parenaście, na każdym co inne napisane. Np mam pliki buttonów: stronaglowna.png i stronaglowna1.png(ten jest inaczej podświetlony). Co zrobić z użyciem css że jak sie najedzie na buttona stronaglowna.png, to pojawi się zamiast niego stronaglowna1.png?
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 19)
adasiu
post
Post #2





Grupa: Zarejestrowani
Postów: 65
Pomógł: 7
Dołączył: 18.01.2007
Skąd: Tychy

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


spróbuj zrobić tak jak tutaj smile.gif
Go to the top of the page
+Quote Post
Spawnm
post
Post #3





Grupa: Moderatorzy
Postów: 4 069
Pomógł: 497
Dołączył: 11.05.2007
Skąd: Warszawa




np:
  1. css:
  2. #st{
  3. background-image: url(320px-ROT13_table_with_example.svg.png);
  4. width:100px;
  5. height:50px
  6. }
  7. #st:hover{
  8. background-image: url(320px-ROT13_table_with_example.svg1.png);
  9. }
  10. html:
  11. <input type='button' id='st' />
Go to the top of the page
+Quote Post
1010
post
Post #4





Grupa: Zarejestrowani
Postów: 749
Pomógł: 37
Dołączył: 3.10.2006

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


hover?


edit: spoznilem się smile.gif

Ten post edytował 1010 8.02.2009, 19:44:48


--------------------
Go to the top of the page
+Quote Post
gniew1971
post
Post #5





Grupa: Zarejestrowani
Postów: 97
Pomógł: 0
Dołączył: 18.12.2008

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


obrazek się nie wyświetla. a i obrazek mam w folderze buttony
Go to the top of the page
+Quote Post
piotrooo89
post
Post #6


Newsman


Grupa: Moderatorzy
Postów: 4 005
Pomógł: 548
Dołączył: 7.04.2008
Skąd: Trzebinia/Kraków




pokaż kod! jak mamy z fusów wróżyć?


--------------------
Go to the top of the page
+Quote Post
gniew1971
post
Post #7





Grupa: Zarejestrowani
Postów: 97
Pomógł: 0
Dołączył: 18.12.2008

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


css:
Kod
#st{
background-image: url("buttony/sg.png");
width: 146px;
height: 39px
}
#st:hover{
background-image: url("buttony/sg1.png");
}



html:
Kod
<div id="menu"><a href="index.html"><input type='button' id='st' /></a></div>
Go to the top of the page
+Quote Post
piotrooo89
post
Post #8


Newsman


Grupa: Moderatorzy
Postów: 4 005
Pomógł: 548
Dołączył: 7.04.2008
Skąd: Trzebinia/Kraków




to coś masz skopane w ścieżkach chyba. tu wygląda ok.

tip: w IE nie będzie chodzić ponieważ on obsługuje pseudo klasę :hover tylko dla linków.


--------------------
Go to the top of the page
+Quote Post
Lion_87
post
Post #9





Grupa: Zarejestrowani
Postów: 850
Pomógł: 120
Dołączył: 15.02.2007
Skąd: Łódź

Ostrzeżenie: (10%)
X----


a nie lepiej bedzie Tobie tak:
  1. <style type="text/css">
  2. A.link {background: url(buttony/sg.png); width:146px;height: 39px;display:block;}
  3. A.link:HOVER{background: url(buttony/sg1.png);width:146px;height: 39px;display:block;}
  4.  
  5. <a class="link" href="#">asdasd</a>


Ten post edytował Lion_87 8.02.2009, 22:11:01
Go to the top of the page
+Quote Post
gniew1971
post
Post #10





Grupa: Zarejestrowani
Postów: 97
Pomógł: 0
Dołączył: 18.12.2008

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


no ale ja mam kilka obrazków więc jak to zrobić? nie bardzo rozumiem...
Go to the top of the page
+Quote Post
Lion_87
post
Post #11





Grupa: Zarejestrowani
Postów: 850
Pomógł: 120
Dołączył: 15.02.2007
Skąd: Łódź

Ostrzeżenie: (10%)
X----


kilka obrazków >> kilka class
  1. <style type="text/css">
  2. A.link_stg {background: url(buttony/sg.png); width:146px;height: 39px;display:block;}
  3. A.link_stg:HOVER{background: url(buttony/sg1.png);width:146px;height: 39px;display:block;}
  4.  
  5. A.link_two {background: url(buttony/two.png); width:146px;height: 39px;display:block;}
  6. A.link_two:HOVER{background: url(buttony/two1.png);width:146px;height: 39px;display:block;}
  7.  
  8. <a class="lin_stg" href="#">asdasd</a>
  9. <a class="link_two" href="#">asdasd</a>


Ten post edytował Lion_87 8.02.2009, 22:14:07
Go to the top of the page
+Quote Post
erix
post
Post #12





Grupa: Moderatorzy
Postów: 15 467
Pomógł: 1451
Dołączył: 25.04.2005
Skąd: Szczebrzeszyn/Rzeszów




Tutaj lepiej byłoby skorzystać z ID, a nie klasy... Klasa - wiele elementów, ID - jeden.

http://www.w3.org/TR/CSS21/selector.html#id-selectors


--------------------

ZCE :: Pisząc PW załączaj LINK DO TEMATU i TYLKO w sprawach moderacji :: jakiś błąd - a TREŚĆ BŁĘDU? :: nie ponaglaj z odpowiedzią via PW!
Go to the top of the page
+Quote Post
gniew1971
post
Post #13





Grupa: Zarejestrowani
Postów: 97
Pomógł: 0
Dołączył: 18.12.2008

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


Mam problem, bo jak są 2 buttony to tylko na IE się dobrze wyświetlają, a na FF jest tylko jeden button. A chce by były na środku
Go to the top of the page
+Quote Post
DeemR
post
Post #14





Grupa: Zarejestrowani
Postów: 16
Pomógł: 1
Dołączył: 7.02.2009
Skąd: Poznań

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


Bez CSS możesz zrobić to tak:
Kod
<img src="buttony/sg.png"  border="0" onMouseOver="this.src = 'buttony/sg1.png'" onMouseOut="this.src = 'buttony/sg.png'" />


Według mnie lepszy sposób
Go to the top of the page
+Quote Post
b4x
post
Post #15





Grupa: Zarejestrowani
Postów: 658
Pomógł: 95
Dołączył: 20.12.2005
Skąd: N54,35° E18,63° (Gdańsk)

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


Cytat(DeemR @ 9.02.2009, 16:01:56 ) *
Bez CSS możesz zrobić to tak:
Kod
<img src="buttony/sg.png"  border="0" onMouseOver="this.src = 'buttony/sg1.png'" onMouseOut="this.src = 'buttony/sg.png'" />


Według mnie lepszy sposób


Wg. mnie nie jest to lepszy sposób. - Co jeśli sobie wyłączę JS ? ;-)

@gniew1971 - mógłbyś pokazać jakiegoś screena - jak to mniej więcej wygląda?

Ten post edytował b4x 9.02.2009, 16:05:34


--------------------
Go to the top of the page
+Quote Post
DeemR
post
Post #16





Grupa: Zarejestrowani
Postów: 16
Pomógł: 1
Dołączył: 7.02.2009
Skąd: Poznań

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


hover też ma swoje wady ...
Go to the top of the page
+Quote Post
gniew1971
post
Post #17





Grupa: Zarejestrowani
Postów: 97
Pomógł: 0
Dołączył: 18.12.2008

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


To wszystko jest na www.fhurm.info/new - uciekają buttony do lewej, a chce by były wyśrofkowane @

Czy ktos mi powie jak je wyśrodkować questionmark.gif?


css:
Kod
div.menu2 a { float: left; }

A.sg {background: url(buttony/sg.png);
background-position: center;
margin: auto;
width:146px;
height: 39px;
display:block;}
A.sg:HOVER{background: url(buttony/sg1.png);
width:146px;
height: 39px;
display:block;}

A.on {background: url(buttony/on.png);background-position: center;margin: auto;width:71px;height: 39px;display:block;}
A.on:HOVER{background: url(buttony/on1.png);width:71px;height: 39px;display:block;}

A.of {background: url(buttony/of.png);background-position: center;margin: auto;width:71px;height: 39px;display:block;}
A.of:HOVER{background: url(buttony/of1.png);width:71px;height: 39px;display:block;}


html:
Kod
<div id="menu"><div class="menu2"><a class="sg" href="index.html"></a><a class="on" href="onas.html"></a><a class="of" href="oferta.html"></a></div></div>


buttony na stronie uciekaja mi do lewej strony ! mozna to zobaczyc na www.fhurm.info/new
Go to the top of the page
+Quote Post
Lion_87
post
Post #18





Grupa: Zarejestrowani
Postów: 850
Pomógł: 120
Dołączył: 15.02.2007
Skąd: Łódź

Ostrzeżenie: (10%)
X----


A w #menu masz text-align:center;??

EDIT: Trudno tu coś wymyślić przez to że jest
Cytat
DISPLAY: BLOCK;
jak by go nie było to wyśrodkowało by sie ale tla linku by nie było.

Ten post edytował Lion_87 9.02.2009, 19:49:00
Go to the top of the page
+Quote Post
gniew1971
post
Post #19





Grupa: Zarejestrowani
Postów: 97
Pomógł: 0
Dołączył: 18.12.2008

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


Tak mam !

to co ja mam robic ?


Kurde, nikt nie pomoże ?
Go to the top of the page
+Quote Post
Lion_87
post
Post #20





Grupa: Zarejestrowani
Postów: 850
Pomógł: 120
Dołączył: 15.02.2007
Skąd: Łódź

Ostrzeżenie: (10%)
X----


Cytat
Kurde, nikt nie pomoże ?

...

Pozostało Ci chyba z IMG zrobić tak jak CI wyżej ktoś napisał:
Cytat
Bez CSS możesz zrobić to tak:
Kod
<img src="buttony/sg.png" border="0" onMouseOver="this.src = 'buttony/sg1.png'" onMouseOut="this.src = 'buttony/sg.png'" />


Według mnie lepszy sposób
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 19.08.2025 - 17:45