Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [css] button
pro-mil
post 29.08.2006, 11:50:05
Post #1





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 28.08.2006

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


Chcę przy wykorzystaniu diva i css (bez javascript i czegość w stylu this.className) zrobić sobie buttonik. Po najechaniu zmienia się tło, ramka, czcionka. No i właśnie mi nie wychodzi smile.gif

Przykładowe buttony: (mają być obok siebie)
  1. <div class="ansbutton"><a href="page1">Tak</a></div>
  2. <div class="ansbutton"><a href="ipage2">Nie</a></div>


no i niebardzo wychodzi mi css:

  1. .ansbutton {
  2. display: inline;
  3. border: 1px solid #a3a3a3;
  4. padding: 0 10px 0 20px;
  5. background: #DCDCDC url(img/arr3.gif) repeat-y;
  6. margin-right: 10px;
  7. text-align: center;
  8. font-family: Helvetica, "Arial CE", Tahoma, Georgia;
  9. font-size : 8pt;
  10. color : #4e4e4e;
  11. text-decoration : none;
  12. }


w tym wypadku czcionka 'TAK' i 'NIE' nie jest brana z .ansbutton tylko z wcześniejszej definicji a {} a tego nie chcę.

nie wiem jak zrobić coś w stylu onmouseover w css.

Kombinowałem tak:
  1. .ansbutton a:hover{
  2. display: inline;
  3. border: 1px solid #808080;
  4. padding: 0 10px 0 20px;
  5. background: #d4d4d4 url(img/arr3.gif) repeat-y;
  6. margin-right: 10px;
  7. text-align: center;
  8. font-family: Helvetica, "Arial CE", Tahoma, Georgia;
  9. font-size : 8pt;
  10. color : #bf4128;
  11. text-decoration : none;
  12. }


ale to nie zmienia mi wyglądu diva tylko czcionki co wydaje mi się logiczne smile.gif ale tego nie chcę.

Kombinowałem i tak:

  1. .ansbutton a {
  2. display: inline;
  3. border: 1px solid #a3a3a3;
  4. padding: 0 10px 0 20px;
  5. background: #DCDCDC url(img/arr3.gif) repeat-y;
  6. margin-right: 10px;
  7. text-align: center;
  8. font-family: Helvetica, "Arial CE", Tahoma, Georgia;
  9. font-size : 8pt;
  10. color : #4e4e4e;
  11. text-decoration : none;
  12. }
  13.  
  14. .ansbutton a:hover{
  15. display: inline;
  16. border: 1px solid #808080;
  17. padding: 0 10px 0 20px;
  18. background: #d4d4d4 url(img/arr3.gif) repeat-y;
  19. margin-right: 10px;
  20. text-align: center;
  21. font-family: Helvetica, "Arial CE", Tahoma, Georgia;
  22. font-size : 8pt;
  23. color : #bf4128;
  24. text-decoration : none;
  25. }


no prawie prawie ale display: inline; nie jest brane pod uwagę tak jak i width i height, co także chyba rozumiem smile.gif.

Uff no nie mam pojecia jak zrobić ten 'kwadracik'. Pomocy smile.gif

Pozdrawiam
pss. sorki za ew herezje ale css to narazie nie moja mocna strona. Szukałem na googlach ale tam same opisy buttonów zrobionych za pomocą input - tego też nie chcę smile.gif
Go to the top of the page
+Quote Post
s_w_ir
post 29.08.2006, 13:55:54
Post #2





Grupa: Zarejestrowani
Postów: 315
Pomógł: 1
Dołączył: 6.08.2003
Skąd: Kielce

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


Daruj sobie divy tu:
  1. <a class="ansbutton" href="page1">Tak</a>
  2. <a class="ansbutton" href="ipage2">Nie</a>

CSS
  1. .ansbutton {
  2. border: 1px solid #a3a3a3;
  3. padding: 0 10px 0 20px;
  4. background: #DCDCDC url(img/arr3.gif) repeat-y;
  5. margin-right: 10px;
  6. text-align: center;
  7. font-family: Helvetica, "Arial CE", Tahoma, Georgia;
  8. font-size : 8pt;
  9. color : #4e4e4e;
  10. text-decoration : none;
  11. }
  12.  
  13. .ansbutton:hover{
  14. border: 1px solid #808080;
  15. padding: 0 10px 0 20px;
  16. background: #d4d4d4 url(img/arr3.gif) repeat-y;
  17. margin-right: 10px;
  18. text-align: center;
  19. font-family: Helvetica, "Arial CE", Tahoma, Georgia;
  20. font-size : 8pt;
  21. color : #bf4128;
  22. text-decoration : none;
  23. }
Go to the top of the page
+Quote Post
cadavre
post 29.08.2006, 14:24:44
Post #3





Grupa: Zarejestrowani
Postów: 472
Pomógł: 7
Dołączył: 7.12.2005
Skąd: Gliwice

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


Bądź też użyj
Kod
onmouseover="this.className='druga_zamienna klasa_ansbuttona'"


--------------------
Silesian PHP User Group - www.spug.pl
Symfony2, OAuth2, budowanie API - masz pytania? Pisz!
Go to the top of the page
+Quote Post
s_w_ir
post 29.08.2006, 14:27:45
Post #4





Grupa: Zarejestrowani
Postów: 315
Pomógł: 1
Dołączył: 6.08.2003
Skąd: Kielce

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


Ja rozumiem że niektóre cechy JS zastępuje się CSS, ale czemu podstawowe cechy CSS zastępować JS?
Go to the top of the page
+Quote Post
pro-mil
post 29.08.2006, 16:06:44
Post #5





Grupa: Zarejestrowani
Postów: 4
Pomógł: 0
Dołączył: 28.08.2006

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


@s_w_ir, właśnie miałem napisać, że darowałem sobie div'y no i w sumie sam poradziłem w identyczny sposób, bo w sumie te div'y na nic są tam potrzebne smile.gif. Ale i tak dziękuję.

Gdyby człowiek zanim napisze o pomoc pomyślał pare minut/godzin smile.gif więcej to byłoby tu połowę postów mniej winksmiley.jpg. Ale czesem już nie ma siły jak ja.

Co do unikania JS, moim zdaniem jeśli istnieje wcale niegorsza alternatywa (jak w tym przypadku) to należy zastosować alternatywę smile.gif.

Pozdrawiam
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 Wersja Lo-Fi Aktualny czas: 19.07.2025 - 16:12