Instruction
1
How to align center depends on the method of layout. You can use <div> tags or <table>. Of course, it is easier to make all the content in a tag <center> but it is obsolete, and there is no guarantee that everything will work correctly. The most modern way is to use the CSS technology.
2
Tag <div> highlights of the code in one unit, allowing you to change the content, asking the fragment to a single font, color, background, etc. At block layout all the contents of the tag <body> is placed in <div>. In the <div> set the alignment attribute align. It will look like this:
the <body>
<div align=”center”>site Content</div>
</body>.
3
Alignment can be set using CSS. You need to create a separate file style sheets or to place all in the same HTML file in <head>. The code will look as follows:
the <head>
<style type="text/css">
* {margin: 0; padding: 0;} <!--reset all indents-->
body {
text-align: center; <!-- align text center-->
}
div {
width: 700px; <!--set the site content width-->
margin: 0 auto; <!--set padding right and left to work center alignment-->
}
</style>
4
In tabular layout alignment is set using the tables in <table>. Code is: <table align=”center”>site Content</table>. The table will be located at the center of the page, respectively, and its contents too. You can also specify the width of any block, putting it with the width parameter.
5
Choosing the width of the page, do not forget that the users screen resolution can be very different from yours. Sometimes, not to be mistaken with the size, you should set all the percentage. This is especially useful if you have a simple website.
6
Whatever method you use, make sure all browsers your site works properly. If he for some reason is not displayed correctly in one of them – please indicate this.