[/HTML]Witam!!!
Chcę zrobić układ podobny do tego (ten jest oparty na tabelce):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="pl">
<table border="0" style="width: 75px; height: 75px;" cellpadding="0" cellspacing="1"> <td style="background: #666666; width: 24px; height: 24px"></td> <td style="background: #999999; width: 24px; height: 24px"></td> <td style="background: #CCCCCC; width: 24px; height: 24px"></td> <td style="background: #999999; width: 24px; height: 24px"></td> <td style="background: #CCCCCC; width: 24px; height: 24px"></td> <td style="background: #FFFFFF; width: 24px; height: 24px"></td> <td style="background: #CCCCCC; width: 24px; height: 24px"></td> <td style="background: #FFFFFF; width: 24px; height: 24px"></td> <td style="background: #666666; width: 24px; height: 24px"></td>
Ale chcę to zrobić za pomocą divów (po tabel nie powinno się używać do formatowania layoutu).
Napisałem coś takiego:
<div style="position: relative; top: 0px; left: 0px; width: 24px; height: 24px; background-color: #666666;"></div> <div style="position: relative; top: -24px; left: 25px; width: 24px; height: 24px; background-color: #999999;"></div> <div style="position: relative; top: -48px; left: 50px; width: 24px; height: 24px; background-color: #CCCCCC;"></div> <div style="position: relative; top: -47px; left: 0px; width: 24px; height: 24px; background-color: #999999;"></div> <div style="position: relative; top: -71px; left: 25px; width: 24px; height: 24px; background-color: #CCCCCC;"></div> <div style="position: relative; top: -70px; left: 0px; width: 24px; height: 24px; background-color: #CCCCCC;"></div> <div style="position: relative; top: -94px; left: 50px; width: 24px; height: 24px; background-color: #666666;"></div>
ale to działa tylko pod niektórymi przeglądarkami. Pod IE pojawia się dość dużo wolnej przestrzeni - jak się doda div i ramkę to jest to dość widoczne:
<div style="border: 1px solid #000000;"> <div style="position: relative; top: 0px; left: 0px; width: 24px; height: 24px; background-color: #666666;"></div> <div style="position: relative; top: -24px; left: 25px; width: 24px; height: 24px; background-color: #999999;"></div> <div style="position: relative; top: -48px; left: 50px; width: 24px; height: 24px; background-color: #CCCCCC;"></div> <div style="position: relative; top: -47px; left: 0px; width: 24px; height: 24px; background-color: #999999;"></div> <div style="position: relative; top: -71px; left: 25px; width: 24px; height: 24px; background-color: #CCCCCC;"></div> <div style="position: relative; top: -70px; left: 0px; width: 24px; height: 24px; background-color: #CCCCCC;"></div> <div style="position: relative; top: -94px; left: 50px; width: 24px; height: 24px; background-color: #666666;"></div></div>
(czytając specyfikację, jest to właściwe zachowanie).
Lecz gdy zamknę to w inny div, już powinno być dobrze, ale nie jest.
Mam nadzieję, że ktoś robił juz coś podobnego, i pewno znalazł lepsze rozwiązanie, od zaproponowanego powyżej.