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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Problems with centering an invisible table


Go to End


4 Posts   2679 Views

Avatar
Marco_D

Community Member, 20 Posts

11 May 2009 at 9:29pm

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

Community Member, 20 Posts

12 May 2009 at 11:14pm

Can anyone provide some help?

Avatar
bummzack

Community Member, 904 Posts

12 May 2009 at 11:34pm

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

Community Member, 20 Posts

13 May 2009 at 7:05pm

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