J'ai cherché sur Stackoverflow si de nombreux messages, mais je n'ai pas trouvé la solution. J'essaie d'aligner mon texte verticalement, en utilisant margin: auto;CSS Margin effondrement en utilisant la marge: auto;
Il semble qu'il y ait une marge problème s'effondrer, si vous voulez vérifier cet exemple:
// HTML
<div class="outer">
<div class="inner">Hello</div>
</div>
<div class="outer2">
<div class="inner">Trying to center this text vertically</div>
</div>
// CSS
.inner {
margin: auto 0;
height: 20px;
color: white;
}
.outer {
background-color: red;
}
.outer2 {
background-color: blue;
height: 200px;
}
If you want to play on my code, click here