Autor Beitrag
kabizolis
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 86



BeitragVerfasst: Fr 09.06.06 08:22 
bis anhin agierte ich, webdesigntechnisch zumindest, jeweilen mit tables in ihrem aufbau... wie kann ich diese table-struktur mit divs simulieren?

ich habe in google einige beiträge dazu gefunden, jedoch keines davon war zufrieden stellend.

ist-situation
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
<table>
 <tr>
  <td>Zelle 1</td>
  <td>Zelle 2</td>
 </tr>
 <tr>
  <td>Zelle 3</td>
  <td>Zelle 4</td>
 </tr>
</table>


soll-situation
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
<div id="table">
 <div id="tr">
  <div id="td">Zelle 1</div>
  <div id="td">Zelle 2</div>
 </div>
 <div id="tr">
  <div id="td">Zelle 3</div>
  <div id="td">Zelle 4</div>
 </div>
</div>


ich könnte mir aber vorstellen, dass dies nicht funktionieren wird, weil das schliessen der div-tags nicht eindeutig identifiziert werden kann...
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Fr 09.06.06 08:26 
Ich würde nicht einfach alle table-Zellen gegen divs ersetzen. Ich würde das komplette Design überdenken. divs sind Container, kein Tabellenersatz. Mit Hilfe von CSS kannst Du die divs auf dem verfügbaren Platz genau platzieren und sie auch in Layern anlegen (also übereinander). Das würde ich z.B . für verschiedene Bereiche einsetzen, wie Navigation, Content, Header, Footer usw.

Aber wenn Du Inhalt in Tabellenform hast, dann würde ich auch eine Tabelle nehmen und das nicht mit divs hinbiegen. Auch eine Verschachtelung solltest Du möglichst sein lassen.
Demonking
ontopic starontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 42

Win XP
Delphi, Delphi 2005 Prof.
BeitragVerfasst: Fr 09.06.06 08:50 
wie UGrohne meinte nutze Tabellen oO
Ich persöhnlich nutze immer Tabellen finde sind leichter zu erstellen und immer übersichtlicher :o
Bei meiner HP nutzte ich immer DiV's nur wenn ich etwas über eine andere grafik drüber positionieren musste ;)

<table> -> <div>
(table besser als div ;) )
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Fr 09.06.06 09:38 
table ist nicht besser als div und auch nicht umgekehrt.
die beiden haben nur andere einsatzgebiete.

ich hab mal irgendwo den schönen satz gehört, dass tables zum darstellen tabellarischen inhalts vorgesehen sind und nicht für designfragen.

_________________
Delphi: XE - OS: Windows 7 Professional x64
wunsiedler
ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 506
Erhaltene Danke: 4

Win7

BeitragVerfasst: Fr 09.06.06 09:40 
probier mal das hier:

page.css (sollte so bleiben)

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
body{
margin:10px;
}
#root{
width: 100$;
border: solid #aaaaaa 1px;
}
#banner {
    height: 60px;
  background-color:#eeeeee;
  
}
#links {
    width: 20%;
    float: left;
  background-color:#ee8888;
  min-height:600px;
}
#mitte {
    width: 80%;
    float:left;
  background-color:#eeee00;
  min-height:600px;
}
#banner2 {
    height: 10px;
  background-color:#eeeeee;
  
}


und

t.php (kannst nennen wie du willst)

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
<?php
    error_reporting(E_ALL);

    echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'";
    echo "         'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>";
    echo "<html>";
    echo "    <head>";
    echo "        <title>Meine Seite</title>";
    echo "        <link rel='stylesheet' type='text/css' href='page.css' />";
    echo "        <meta http-equiv='Content-Type'
                        content='text/html; charset=ISO-8859-1' />";
    echo "    </head>";
    echo "    <body>";

    echo "        <div id='root'>"; // ganz oberer Div-Holder
    echo "            <div id='banner'>"; // banner
    echo "                Der Banner";
    echo "            </div>";
    echo "            <div id='links'>"; // linkes Menu
    echo "                Hier kommt ein Menu hin <br>Hallo";
    echo "            </div>";
    echo "            <div id='mitte'>"; // In der Mitte der Inhalt
    echo "                Hier werden dann die Daten geladen, wie News";
    echo "                <br>oder Memberliste.";
    echo "            </div>";
  echo "            <br style='clear:both;' />"; // css-float beenden
  echo "            <div id='banner2'>"; // banner
    echo "                Unten";
    echo "            </div>";
    echo "            <br style='clear:both;' />"; // css-float beenden
    echo "       </div>";

    echo "    </body>";
    echo "</html>";
?>


is jetzt ne php datei, kannst dir aber das html rausziehen.
Horschdware
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 744
Erhaltene Danke: 54

Win XP Pro, Win 7 Pro x64
Delphi 7, Delphi XE, C++ Builder 5, SAP R/3
BeitragVerfasst: Fr 09.06.06 10:04 
mypage.php
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
<?php
  echo "Jetzt gehts los";
  ShowThatPage();

  function ShowThatPage()  
  {
   ?>
   <html>
    <body>
      Inhalt
    </body>
   </html>
   <?php
  }
?>


ist vllt etwas praktischer als jede zeile per echo rauszuhauen...

_________________
Delphi: XE - OS: Windows 7 Professional x64
wunsiedler
ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 506
Erhaltene Danke: 4

Win7

BeitragVerfasst: Fr 09.06.06 10:18 
user profile iconHorschdware hat folgendes geschrieben:
mypage.php
ist vllt etwas praktischer als jede zeile per echo rauszuhauen...


lag halt so auf meiner festplatte..........
UGrohne
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Veteran
Beiträge: 5502
Erhaltene Danke: 220

Windows 8 , Server 2012
D7 Pro, VS.NET 2012 (C#)
BeitragVerfasst: Fr 09.06.06 10:26 
user profile iconHorschdware hat folgendes geschrieben:
table ist nicht besser als div und auch nicht umgekehrt.
die beiden haben nur andere einsatzgebiete.

ich hab mal irgendwo den schönen satz gehört, dass tables zum darstellen tabellarischen inhalts vorgesehen sind und nicht für designfragen.

Genau das was ich meinte.

Schau Dir auch mal diese Seite an. Dort gibt's einige gute Beispiele, wie man divs verwendet und wie nicht. Vor allem in Zusammenhang mit CSS.