Centré un site ( <div> ) j'y arrive pas...

Bonjour,
Aidez moi svp donnez moi le code à rajouter pour que ces <div>
soit tous centré au milieu de la page et cela quelque soit la résolution !! plzz

div#bandeau {text-align:center
float:left;
width:1000px;
height:150px;
background-color:#00CCFF;
}
div#menu {
float:left;
width:200px;
height:1000px;
background-color:#FF0000;
}

div#contenu {
float:left;
width:800px;
height:1000px;
background-color:#FFCC00;
}

div#pied_page {
clear:both;
width:1000px;
height:100px;
background-color:#33FF99;
}
Configuration: Windows 7
Firefox 3.5.5

5 réponses

  1. Rajoute une div id="container" autour des autres div et fait ceci dans ton css:

    body { width:100%; height:100%; text-align:center; }
    #container { text-align:left; width:800px; margin:0 auto; }
    0
    1. div#container {
      width:2000px;
      height:1200px;

      div#bandeau {text-align:center;
      margin-left:15% ;
      width:1000px;
      height:150px;
      background-image:url('testbandeau.jpg');
      }
      div#menu {
      float:left;
      margin-left:15% ;
      width:1000px;
      height:50px;
      background-color:#FF0000;
      }

      div#contenu {
      float:left;
      margin-left:15% ;
      width:1000px;
      height:800px;
      background-image:url('back.jpg');
      }

      div#pied_page {
      clear:both;
      margin-left:15% ;
      width:1000px;
      height:100px;
      background-color:#33FF
      }
      }
      0
      1. div#container {
        width:2000px;
        height:1200px;

        div#bandeau {text-align:center;
        margin-left:15% ;
        width:1000px;
        height:150px;
        background-image:url('testbandeau.jpg');
        }
        div#menu {
        float:left;
        margin-left:15% ;
        width:1000px;
        height:50px;
        background-color:#FF0000;
        }

        div#contenu {
        float:left;
        margin-left:15% ;
        width:1000px;
        height:800px;
        background-image:url('back.jpg');
        }

        div#pied_page {
        clear:both;
        margin-left:15% ;
        width:1000px;
        height:100px;
        background-color:#33FF
        }
        }
        0
        1. Tu n'as pas bien compris...

          fais comme ceci dans ton html :
          <body> <!--- ceci est le body de ta page //-->
          <div id="container">
          <!--// ton contenu //-->
          </div>
          </body>

          et dans ton css :
          body { width:100%; height:100%; text-align:center; }
          #container {
          width:800px;
          height:100%
          margin:0 auto;
          text-align:left;
          }
          /* et ici le reste de ton css */

          Compris ?
          0