Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Archive

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, biapar, Willr, Ingo, simon_w

Problems with centering an invisible table


Reply

4 Posts   1546 Views

Avatar
Marco_D

11 May 2009 at 9:29pm Community Member, 20 Posts

Hey guys,

currently I am trying to center an invisible table. The table alignment is set to "center", but in this case the table is still shown on the left.
This is my source code:

<table border="0" align="center">
<tbody>
<tr>
<td style="text-align: center;">
<div class="image center" style="width: 360px; text-align: center;"><img src="assets/Uploads/schlaf1.jpg?r=95536" alt="" width="360" height="270" /></div>
Im Schlafzimmer befindet sich ein Doppelbett<br /> (Bei Bedarf ist eine Aufbettung oder Baby-Bett vorhanden)</td>
</tr>
</tbody>
</table>


Is there any solution?

Thanks in advance
Greetings from Karlsruhe, Germany
Marco

Avatar
Marco_D

12 May 2009 at 11:14pm Community Member, 20 Posts

Can anyone provide some help?

Avatar
banal

12 May 2009 at 11:34pm Community Member, 901 Posts

Your align "instructions" effect the contents of the table, not the table itself.
To center your table I'd try something along these lines:

<div style="text-align:center;">
   <table>
      ... table content ...
   </table>
</div>

I hope your code doesn't look exactly like the one you posted though. Because in that case you won't need a table at all :)

Avatar
Marco_D

13 May 2009 at 7:05pm Community Member, 20 Posts

Hey guys,

@banal: thanks for your advice.

I tried different options, the solution I have found is the following:

<div style="text-align: center">
<div class="image center" style="margin: 0px auto; width: 360px; text-align: center;"><img src="assets/Uploads/_resampled/ResizedImage360270-schlaf1.jpg" alt="" width="360" height="270" /></div>
Im Schlafzimmer befindet sich ein Doppelbett<br /> (Bei Bedarf ist eine Aufbettung oder Baby-Bett vorhanden)</div>


The crux is

margin: 0px auto;


which aligns the image at the center.

Kind Regards
Marco