Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML] Jak zamienić zwykłe obrazki na tło
Devik
post 19.02.2008, 17:48:14
Post #1





Grupa: Zarejestrowani
Postów: 30
Pomógł: 0
Dołączył: 27.03.2007
Skąd: Węgrów

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


Witam!

Nie wiedziałem jak za bardzo podpisać temat, tak aby był adekwatny do tego z czym mam problem, więc jeżeli z góry nie jest on taki jak powinien to przepraszam. Stworzyłem sobie stronę www w Photoshopie w ImageReady pociąłem grafikę na kawałki i automatycznie utworzyłem kod HTML'a (za pomocą IR). Niestety kod, który jest stworzony nie jest taki jaki chciałbym aby był, głównie chodzi mi o to, by zamiast zwykłych obrazków było stałe tło, którego nie można byłoby zaznaczyć. Nie mam zielonego pojęcia w jaki sposób to zrobić, aby całkowicie nie pisać od podstaw ręcznie tego, gdyż aż tak dobrze nie znam się na pisaniu kodu HTML. Poniżej zamieszczam całe 81 linijek kodu.

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <title>koncowe</title>
  4. <meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
  5. </head>
  6. <body bgcolor="#000000">
  7. <!-- ImageReady Slices (koncowe.psd) -->
  8.  
  9. <table id="Table_01" width="970" border="0" cellpadding="0" cellspacing="0" align="center">
  10. <tr>
  11. <td>
  12. <img id="index_01" src="images/index_01.png" width="75" height="101" alt="" /></td>
  13. <td>
  14. <img id="index_02" src="images/index_02.png" width="176" height="101" alt="" /></td>
  15. <td>
  16. <img id="index_03" src="images/index_03.png" width="225" height="101" alt="" /></td>
  17. <td>
  18. <img id="index_04" src="images/index_04.png" width="221" height="101" alt="" /></td>
  19. <td>
  20. <img id="index_05" src="images/index_05.png" width="200" height="101" alt="" /></td>
  21. <td>
  22. <img id="index_06" src="images/index_06.png" width="73" height="101" alt="" /></td>
  23. </tr>
  24. <tr>
  25. <td>
  26. <img id="index_07" src="images/index_07.png" width="75" height="108" alt="" /></td>
  27. <td>
  28. <img id="index_08" src="images/index_08.png" width="176" height="108" alt="" /></td>
  29. <td>
  30. <img id="index_09" src="images/index_09.png" width="225" height="108" alt="" /></td>
  31. <td>
  32. <img id="index_10" src="images/index_10.png" width="221" height="108" alt="" /></td>
  33. <td>
  34. <img id="index_11" src="images/index_11.png" width="200" height="108" alt="" /></td>
  35. <td>
  36. <img id="index_12" src="images/index_12.png" width="73" height="108" alt="" /></td>
  37. </tr>
  38. <tr>
  39. <td>
  40. <img id="index_13" src="images/index_13.png" width="75" height="36" alt="" /></td>
  41. <td>
  42. <img id="index_14" src="images/index_14.png" width="176" height="36" alt="" /></td>
  43. <td colspan="2">
  44. <img id="index_15" src="images/index_15.png" width="446" height="36" alt="" /></td>
  45. <td>
  46. <img id="index_16" src="images/index_16.png" width="200" height="36" alt="" /></td>
  47. <td>
  48. <img id="index_17" src="images/index_17.png" width="73" height="36" alt="" /></td>
  49. </tr>
  50. <tr>
  51. <td>
  52. <img id="index_18" src="images/index_18.png" width="75" height="49" alt="" /></td>
  53. <td>
  54. <img id="index_19" src="images/index_19.png" width="176" height="49" alt="" /></td>
  55. <td>
  56. <img id="index_20" src="images/index_20.png" width="225" height="49" alt="" /></td>
  57. <td>
  58. <img id="index_21" src="images/index_21.png" width="221" height="49" alt="" /></td>
  59. <td>
  60. <img id="index_22" src="images/index_22.png" width="200" height="49" alt="" /></td>
  61. <td>
  62. <img id="index_23" src="images/index_23.png" width="73" height="49" alt="" /></td>
  63. </tr>
  64. <tr>
  65. <td colspan="6">
  66. <img id="index_24" src="images/index_24.png" width="970" height="136" alt="" /></td>
  67. </tr>
  68. <tr>
  69. <td colspan="6">
  70. <img id="index_25" src="images/index_25.png" width="970" height="414" alt="" /></td>
  71. </tr>
  72. <tr>
  73. <td colspan="6">
  74. <img id="index_26" src="images/index_26.png" width="970" height="92" alt="" /></td>
  75. </tr>
  76.  
  77. <!-- End ImageReady Slices -->
  78. </body>
  79. </html>


Czy ktoś potrafi mi pomóc? Z góry dziękuje.

Pozdrawiam


--------------------
Lepiej jest nie odzywać się wcale i wydać się głupim,
niż odezwać się i rozwiać wszelkie wątpliwości...
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 10)
Cezar708
post 19.02.2008, 18:26:38
Post #2





Grupa: Zarejestrowani
Postów: 1 116
Pomógł: 119
Dołączył: 10.05.2005
Skąd: Poznań

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


1. usuń wszystko spomiędzy <body> i </body>
2. znacznik body zmień na:
  1. <body style="background-image: url('index.png');background-color: #000000">


zakładam, że plik, który wcześniej pociąłeś nazywa się index.png i znajduje się w tym samym katalogu co plik html.

jak Ci się wynik spodoba to poczytaj o CSS2 (lub CSS3) i wyrzuć wszystko do zewnętrznego pliku CSS.

Pozdrawiam
Go to the top of the page
+Quote Post
Devik
post 19.02.2008, 18:35:55
Post #3





Grupa: Zarejestrowani
Postów: 30
Pomógł: 0
Dołączył: 27.03.2007
Skąd: Węgrów

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


Nie po to pociąłem dokładnie cały plik na części, aby mi się jeden dłużej wczytywał smile.gif

CSS2 CSS3 a co dokładniej? Bo nie rozumiem


--------------------
Lepiej jest nie odzywać się wcale i wydać się głupim,
niż odezwać się i rozwiać wszelkie wątpliwości...
Go to the top of the page
+Quote Post
Cezar708
post 19.02.2008, 18:51:31
Post #4





Grupa: Zarejestrowani
Postów: 1 116
Pomógł: 119
Dołączył: 10.05.2005
Skąd: Poznań

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


no tak, rozumiem, tylko jeśli chcesz to mieć jako tło to w ten sposób będzie Ci bardzo ciężko efekt taki osiągnąć, ponieważ nie można jako tło podać kilka obrazków.

Chyba, że interesuje Cię takie rozwiązanie, że dla każdej komórki tabeli podasz osobno plik z tłem, coś w stylu:
  1. (..)
  2. <td style="background-image('images/index_01.png'); width: 225; height: 101px;">
  3. &nbsp;
  4. </td>
  5. <td style="background-image('images/index_02.png'); width: 225; height: 101px;">
  6.  
  7. </td>
  8. <td style="background-image('images/index_03.png'); width: 225; height: 101px;">
  9. &nbsp;
  10. </td>(..)


aczkolwiek uważam, że będzie to rozwiązanie kłopotliwe, bo jak wcześniej wspomniałem będziesz musiał osobno każdą komórkę tabeli wypełnić

Cytat
CSS2 CSS3 a co dokładniej? Bo nie rozumiem

chodziło mi o to, żebyś style CSS zapisał w osobnym pliku, a nie w znacznikach style="", jak pokazałem Ci w tych przykładach

Pozdrawiam
Go to the top of the page
+Quote Post
Sebastian003
post 19.02.2008, 19:29:22
Post #5





Grupa: Zarejestrowani
Postów: 282
Pomógł: 2
Dołączył: 22.03.2007

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


Jeszcze lepiej oprzeć ten szablon na elemencie blokowym div smile.gif
Go to the top of the page
+Quote Post
-Wieviór-
post 19.02.2008, 19:43:19
Post #6





Goście







Czy 100 orazków 10x10 jest rzeczywiście lepsze niż jeden 100x100?
Go to the top of the page
+Quote Post
nowotny
post 19.02.2008, 20:00:30
Post #7





Grupa: Zarejestrowani
Postów: 875
Pomógł: 122
Dołączył: 2.02.2008

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


Cytat(Wieviór @ 19.02.2008, 19:43:19 ) *
Czy 100 orazków 10x10 jest rzeczywiście lepsze niż jeden 100x100?

Tu akurat nie jest... biggrin.gif

Hint: 100 obrazków 10x10 to jeden obrazek 1000x1000... winksmiley.jpg
Go to the top of the page
+Quote Post
-Wieviór-
post 19.02.2008, 20:17:56
Post #8





Goście







yyy... wytłumacz mi swoją teorię... ;]
Go to the top of the page
+Quote Post
Devik
post 19.02.2008, 21:42:33
Post #9





Grupa: Zarejestrowani
Postów: 30
Pomógł: 0
Dołączył: 27.03.2007
Skąd: Węgrów

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


Cezar708: Wielkie dzięki, teraz tylko mi powiedz w jaki sposób mam to zapisać jako *.css smile.gif

Napotkałem na pierwsze problemy związane z przekształcaniem kodu w style, oto i one smile.gif


  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
  4. </head>
  5. <body bgcolor="#000000">
  6. <!-- POCZĄTEK -->
  7.  
  8. <table id="Table_01" width="970" border="0" cellpadding="0" cellspacing="0" align="center">
  9. <tr>
  10. <td style="width: 75px; height: 101px; background: url(images/index_01.png);"></td>
  11. <td style="width: 176px; height: 101px; background: url(images/index_02.png);"></td>
  12. <td style="width: 225px; height: 101px; background: url(images/index_03.png);"></td>
  13. <td style="width: 221px; height: 101px; background: url(images/index_04.png);"></td>
  14. <td style="width: 200px; height: 101px; background: url(images/index_05.png);"></td>
  15. <td style="width: 73px; height: 101px; background: url(images/index_06.png);"></td>
  16. </tr>
  17. <tr>
  18. <td style="width: 75px; height: 108px; background: url(images/index_07.png);"></td>
  19. <td style="width: 176px; height: 108px; background: url(images/index_08.png);"></td>
  20. <td style="width: 225px; height: 108px; background: url(images/index_09.png);"></td>
  21. <td style="width: 221px; height: 108px; background: url(images/index_10.png);"></td>
  22. <td style="width: 200px; height: 108px; background: url(images/index_11.png);"></td>
  23. <td style="width: 73px; height: 108px; background: url(images/index_12.png);"></td>
  24. </tr>

Do tego momentu jest wszystko spoko, ale dalej już zaczynają się problemy bo mi się rozjeżdża wszystko.

  1. <tr>
  2. <td style="width: 75px; height: 36px; background: url(images/index_13.png);"></td>
  3. <td style="width: 176px; height: 36px; background: url(images/index_14.png);" colspan="2"></td>
  4. <td style="width: 446px; height: 36px; background: url(images/index_15.png);"></td>
  5. <td style="width: 200px; height: 36px; background: url(images/index_16.png);"></td>
  6. <td style="width: 73px; height: 36px; background: url(images/index_17.png);"></td>

Tak wygląda teraz, a poniżej jak poprzednio

  1. <td>
  2. <img id="index_13" src="images/index_13.png" width="75" height="36" alt="" /></td>
  3. <td>
  4. <img id="index_14" src="images/index_14.png" width="176" height="36" alt="" /></td>
  5. <td colspan="2">
  6. <img id="index_15" src="images/index_15.png" width="446" height="36" alt="" /></td>
  7. <td>
  8. <img id="index_16" src="images/index_16.png" width="200" height="36" alt="" /></td>
  9. <td>
  10. <img id="index_17" src="images/index_17.png" width="73" height="36" alt="" /></td>
  11. </tr>


No i dalej w sumie też jest źle, ale o tym później smile.gif Co z tym co tu mam zrobić?

Ten post edytował Devik 20.02.2008, 00:54:01


--------------------
Lepiej jest nie odzywać się wcale i wydać się głupim,
niż odezwać się i rozwiać wszelkie wątpliwości...
Go to the top of the page
+Quote Post
Cezar708
post 20.02.2008, 11:21:42
Post #10





Grupa: Zarejestrowani
Postów: 1 116
Pomógł: 119
Dołączył: 10.05.2005
Skąd: Poznań

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


ja proponuje wszystko od nowa:

1. podziel cały Twój obrazek na RÓWNE części (chodzi o to, aby wszystkie były jednej wielkości)

2. następnie stwórz plik HTML:
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <meta http-equiv="Content-Type" content="text/html; charset=windows-1250" />
  4. <link rel="StyleSheet" href="/style.css" type="text/css" media="screen"> <!-- tu import CSS -->
  5. </head>
  6. <!-- POCZĄTEK -->
  7. <div id="container">
  8. <div id="content">
  9. Tu jest treść strony, zauważ, że pod tym jest Twoje tło
  10. </div>
  11. <table id="Table_01" width="970" border="0" cellpadding="0" cellspacing="0" align="center">
  12. <tr>
  13. <td class="td1x1"></td>
  14. <td class="td1x2"></td>
  15. <td class="td1x3"></td>
  16. <td class="td1x4"></td>
  17. <td class="td1x5"></td>
  18. <td class="td1x6"></td>
  19. </tr>
  20. <tr>
  21. <td class="td2x1"></td>
  22. <td class="td2x2"></td>
  23. <td class="td2x3"></td>
  24. <td class="td2x4"></td>
  25. <td class="td2x5"></td>
  26. <td class="td2x6"></td>
  27. </tr>
  28. </table>
  29. </div>
  30. </body>
  31. </html>


3. trzeci krok to napisanie CSS:
Kod
body {
background-color: silver;
}
div#content{
  position: absolute;
  top: 100px; /* top i left regulujesz gdzie chcesz miec ulozony kontent */
  left: 100px;
}
table#Table_01 tr td{
  width: 128px;
  height: 105px;
}
td.td1x1{
  background-image: url(images/index_01.png);
}
td.td1x2{
  background-image: url(images/index_02.png);
}
td.td1x3{
  background-image: url(images/index_03.png);
}
td.td1x4{
  background-image: url(images/index_04.png);
}
td.td1x5{
  background-image: url(images/index_05.png);
}
td.td1x6{
  background-image: url(images/index_06.png);
}
td.td2x1{
  background-image: url(images/index_07.png);
}
td.td2x2{
  background-image: url(images/index_08.png);
}
td.td2x3{
  background-image: url(images/index_09.png);
}
td.td2x4{
  background-image: url(images/index_10.png);
}
td.td2x5{
  background-image: url(images/index_11.png);
}
td.td2x6{
  background-image: url(images/index_12.png);
}
/* i tak dalej */


4. w Divie o id = content wrzucasz swoją treść strony, a wszystko co jest ma być będzie tłem..

Mam nadzieję, że idee przestawiłem w sposób dość zrozumiały.

Pozdrawiam
Go to the top of the page
+Quote Post
Devik
post 20.02.2008, 11:33:47
Post #11





Grupa: Zarejestrowani
Postów: 30
Pomógł: 0
Dołączył: 27.03.2007
Skąd: Węgrów

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


Okej dobra poradziłem sobie sam z problemem nie rozpoczynając nic od nowa, tamten sposób wydawał mi się lepszy dlatego spędziłem przy nim więcej czasu. Dzięki za wszystko i za dobre chęci smile.gif

Pozdrawiam

Ten post edytował Devik 20.02.2008, 12:11:31


--------------------
Lepiej jest nie odzywać się wcale i wydać się głupim,
niż odezwać się i rozwiać wszelkie wątpliwości...
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: 14.08.2025 - 02:04