Centrer son site (© Cédric Geffroy)
- Robert Gastaud - Conseil
Ci-dessous, le code permettant de centrer horizontalement ET verticalement un site ne prenant pas la totalité de l'écran :
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans nom</title>
<style>
body, html {height: 99%; padding: 0px 0px 0px 0px;}
/* Style du tableau principal pour le centrage du site */
#principal {
padding: 0px 0px 0px 0px;
width: 100%;
height: 99%;
}
/* Style du second tableau pour le centrage du site */
#contenu {
padding: 0px 0px 0px 0px;
margin: auto auto;
}
</style>
</head>
<body>
<table id="principal">
<tr> <td>
<table id="contenu">
<tr><td>
<div >
<img src="http://www.google.fr/intl/fr_fr/images/logo.gif" alt="logo" />
</div>
</td></tr>
</table>
</td></tr>
</table>
</body>
</html>