Thomas J.S.: tabelle über CSS zentrieren ua.

Beitrag lesen

Hallo Jens,

da steht ganz genau, wie es berechnet wird:

'margin-left' + 'border-left-width' + 'padding-left' + 'width' + 'padding-right' + 'border-right-width' + 'margin-right' = width of containing block

da steht nicht mehr und weniger, als wie die gesamtbreite eines elemes berechnet wird.

wozu allerdings die ganze diskussion nun gut war:

div {width:100%;}
    table {margin:auto;}

<body>
<div>
<table>
<tr><td>1</td><td>2</td></tr>
<tr><td>3</td><td>4</td></tr>
</table>
</div>
</body>
</html>

also die antwort auf die ursprüngliche frage wurde gefunden.

grüße
thomas