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

Jimmy31120 Messages postés 60 Statut Membre -  
monkey_monk Messages postés 681 Statut Membre -
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;
}
A voir également:

5 réponses

monkey_monk Messages postés 681 Statut Membre 131
 
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
Jimmy31120 Messages postés 60 Statut Membre
 
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
Jimmy31120 Messages postés 60 Statut Membre
 
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
Jimmy31120 Messages postés 60 Statut Membre
 
marche pas
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
monkey_monk Messages postés 681 Statut Membre 131
 
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