Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Divy vs. tabelki i problemy
chyzio
post 5.02.2009, 16:24:43
Post #1





Grupa: Zarejestrowani
Postów: 93
Pomógł: 0
Dołączył: 12.03.2006

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


Nie wiem jak wyświetlić czerwone elementy obok zielonych i nie wiem jak to zrobić. (po lewej zielony po prawej zielony w jednej lini)

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl">
  3. </head>
  4.  
  5.  
  6. <div style="width:450px">
  7. <div style="float:left;width:450px;height:50px;background-color: #666666;margin: 0 1px 0 0"></div>
  8. <div style="float:left;width:150px;height:50px;background-color: green;margin: 0 1px 0 0"></div>
  9. <div style="float:left;width:300px;height:50px;background-color: red"></div>
  10. <div style="float:left;width:150px;height:50px;background-color: green;margin: 0px 1px 0 0"></div>
  11. <div style="float:left;width:300px;height:50px;background-color: red; margin: 0px 1px 0 0"></div>
  12. <div style="float:left;width:450px;height:50px;background-color: yellow;margin: 1px 0 0 0"></div>
  13. </div>
  14.  
  15. </body>
  16. </html>


rozwiązanie mam ale pod IE się nie sprawdza :/

  1. <div style="width:450px">
  2.  
  3. <div style="float:left;width:450px; height:50px;background-color: #666666; margin: 0 0px 1px 0"></div>
  4.  
  5. <div style="float:left;width:150px; height:50px;background-color: green; margin: 0px 0px 0px 0px"></div>
  6. <div style="float:left;width:300px; height:50px;background-color: red; margin: -50px 0px 1px 150px"></div>
  7.  
  8. <div style="float:left;width:150px; height:50px;background-color: green; margin: 0px 0px 0px 0px"></div>
  9. <div style="float:left;width:300px; height:50px;background-color: red; margin: -50px 0px 1px 150px"></div>
  10.  
  11. <div style="float:left;width:150px; height:50px;background-color: green; margin: 0px 0px 0px 0px"></div>
  12. <div style="float:left;width:300px; height:50px;background-color: red; margin: -50px 0px 1px 150px"></div>


kod działa poprawnie tylko w ff jak to poprawić ? Podejrzewam że chodzi o ujemny margines

Ten post edytował chyzio 5.02.2009, 16:43:14
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 1)
JoShiMa
post 5.02.2009, 17:16:46
Post #2





Grupa: Zarejestrowani
Postów: 1 374
Pomógł: 149
Dołączył: 1.03.2006

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


A po co Ci ujemny margines. To się robi dając float: left dla wszystkich a dla tych co sa po lewej czyli mają przechodzić do nowej linii daje się clear:both;

Możesz jeszcze zrobić tak, że czerwony z zielonym w parze są wewnątrz <li></li>

Ten post edytował JoShiMa 5.02.2009, 17:17:27


--------------------
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 - 04:55