Centring A Table In XHTML 1.0 Strict

  Red Devil 14:24 20 Mar 2014
Locked

Hi all,

As the subject says, I would like to add a table to my website design. I am using XHTML 1.0 strict for the first time so am unsure how/if I can set the table to justify so that it displays in the centre of the page I am currently working on.

Can anyone tell me if/how this can be done in XHTML?

Thanks,

RD

  Forum Editor 19:58 20 Mar 2014

Are you using a CSS style sheet? If you are, this line will centre all tables horizontally:

table { margin: auto; }

It tells the browser to make margins on all sides of the table equal, so it will be centred on the page.

If you just want to do it with one table you can add this line directly to the table:

table style="margin: auto;" but enclose the line with < and >

I have to type it like that because otherwise our site will not display the code.

  Red Devil 21:29 20 Mar 2014

Hi FE,

I do have a CSS style sheet but I am also doing this only for 1 table on the page so I may well add it directly to the table.

Thanks,

RD

This thread is now locked and can not be replied to.

Elsewhere on IDG sites

What is ransomware and how do I protect my PC from Petya?

Microsoft Surface Studio – the artist's hands-on review

Original iPhone review

Comment mettre à jour Kodi ?