Centré un site ( <div> ) j'y arrive pas...
Jimmy31120
Messages postés
60
Statut
Membre
-
monkey_monk Messages postés 681 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;
}
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:
- Centré un site ( <div> ) j'y arrive pas...
- Site de telechargement - Accueil - Outils
- Site x - Guide
- Site pour partager des photos - Guide
- Quel site remplace coco - Accueil - Réseaux sociaux
- Site comme coco - Accueil - Réseaux sociaux
5 réponses
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; }
body { width:100%; height:100%; text-align:center; }
#container { text-align:left; width:800px; margin:0 auto; }
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
}
}
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
}
}
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
}
}
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
}
}
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question
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 ?
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 ?