How do I center align table and it's contents

Create a successful portfolio or freelance web design showcase website Joomla theme discussion forum.
GK User
Mon Aug 19, 2013 1:31 pm
Hi Guys,

How do I center align table and it's contents. I have tried millions of things mentioned with no luck. Have a look at the link below:

http://simplecloudsync.com/


Thanks.
User avatar
Fresh Boarder

GK User
Mon Aug 19, 2013 1:36 pm
To center an element with known width, use inline styling:
margin: 0 auto;
for entire element (table in this case)
User avatar
Moderator

GK User
Mon Aug 19, 2013 1:42 pm
And if it goest to images, set their float to none with use of inline css.
User avatar
Moderator

GK User
Mon Aug 19, 2013 1:54 pm
I am not too sure where to make the changes. Here is the code for the article, I have removed the unnecessary text.

Code: Select all
<table border="0" align="center">
<tbody>
<tr>
<td><img src="images/frontpage/Cloud.png" alt="Cloud" /></td>
</tr>
<tr>
<td><img src="images/frontpage/Arrows.gif" alt="Arrows" /></td>
</tr>
<tr>
<td><img src="images/frontpage/Platforms.png" alt="Platforms" /></td>
</tr>
</tbody>
</table>
User avatar
Fresh Boarder

GK User
Mon Aug 19, 2013 5:16 pm
I have managed to center the table using, but I am having no luck with the table data.

Code: Select all
<table style="margin: 0 auto;" border="0">
<tbody>
<tr>
<td><img src="images/frontpage/Cloud.png" alt="Cloud" /></td>
</tr>
<tr>
<td><img align="middle" src="images/frontpage/Arrows.gif" alt="Arrows" /></td>
</tr>
<tr>
<td><img src="images/frontpage/Platforms.png" alt="Platforms" /></td>
</tr>
</tbody>
</table>
User avatar
Fresh Boarder

GK User
Mon Aug 19, 2013 7:31 pm
Code: Select all
<td style="text-align: center;"><img src="images/frontpage/Platforms.png" alt="Platforms" style="float:none;" /></td>

Its just a sample that should work.
User avatar
Moderator

GK User
Tue Aug 20, 2013 11:02 am
That still doesn't work. I have now put that page on http://simplecloudsync.com/index.php/user-guide.

For the image that is aligned I had to create images big as the table with white space on the sides to make it have the appearance to be center aligned.

I can't do this for all the images, so if you could please resolve this for me please. I can email you login details if that will help.

Thanks in advance
User avatar
Fresh Boarder

GK User
Tue Aug 20, 2013 4:31 pm
It is because You still havent applied styling to table td elements and images inside.
IS it inside of a custom HTML module?
User avatar
Moderator

GK User
Tue Aug 20, 2013 5:57 pm
This is a normal article and here is the latest code I am using

Code: Select all
<table style="margin: 0 auto;" border="0">
<tbody>
<tr>
<td style="text-align: center;" align="center" valign="middle"><img src="images/frontpage/Cloud.png" alt="Cloud" /></td>
</tr>
<tr>
<td style="text-align: center;" align="center" valign="middle"><img src="images/frontpage/Arrows.gif" alt="Arrows" /></td>
</tr>
<tr>
<td style="text-align: center;" align="center" valign="middle"><img style="float: none;" src="images/Platforms.png" alt="Platforms"/></td>
</tr>
</tbody>
</table>
User avatar
Fresh Boarder

GK User
Tue Aug 20, 2013 6:01 pm
Just as a side note text aligns perfectly
User avatar
Fresh Boarder

GK User
Thu Aug 22, 2013 4:31 pm
Please post an url to exact location of this table.
User avatar
Moderator

GK User
Thu Aug 22, 2013 4:47 pm
User avatar
Fresh Boarder

GK User
Mon Aug 26, 2013 6:48 am
You have text-align center on td elements but You havent cleared floats on images.
User avatar
Moderator


cron