J'ai le code:Container centre d'alignement vertical considérant en-tête et pied de page
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style>
html, body {
height: 100%;
}
.container {
min-height: 200px;
max-height: 500px;
display: -ms-flexbox;
display: flex;
-ms-flex-pack: justify;
justify-content: space-between;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
box-sizing: border-box;
max-width: 1440px;
margin: auto;
height: 100%;
}
header, footer {
height: 150px;
background: #ccc;
}
footer {
position: absolute;
width: 100%;
height: 50px;
bottom: 0;
}
</style>
</head>
<body>
<header></header>
<div class="container">
content blah blah blah
</div>
<footer>
fsdfsdfsdfsdfsdffdsadsfasd
</footer>
</body>
</html>
Comment je peux centre aligner verticalement ce conteneur, étant donné la hauteur d'en-tête et pied de page (position: absolute et hauteur). Je pense, ce que nous pouvons faire avec display: flex, comment?
J'utilise Bootstrap 3 grille
Exemple jsbin: http://jsbin.com/timatozuco/edit?html,output
Mais si j'utilise bootstrap 3, comment je peux mettre en œuvre ce code? – DronaxD
bien, maintenant c'est une question complètement différente et vous ne l'avez pas mentionné plus tôt, mais dans le cas où vous utilisez Bootstrap alors peut-être cela pourrait vous aider. https://stackoverflow.com/questions/15641142/bootstrap-fill-fluid-container-between-header-and-footer – Adeel
@DronaxD maintenant vous avez ajouté Bootstrap 3 dans votre question :) – Adeel