How to centre a page (ie a div) in CSS

The aim in this case is to centre the page or a section of a page (a div) but not  centring  the text or images within the  page or block.

So you can’t use text-align: center in your CSS as this will centre text.

The solution is to use either in the CSS for the DIV being centred after the width property:

margin-left: auto ;

margin-right: auto ;

or  you could try:

margin: 10px auto 10px auto;

(the syntax being margin: top right bottom left;)

The article, How to Centre a DIV Block Using CSS by Christopher Heng shows very clearly how to do this in detail.

Steven