Look at the following two images:
Enabling or disabling the table-cell attribute excludes width and height information. In fact, I already turned off the browser, but reusing them doesnβt change anything.
Use display:table-cellis the only way to use vertical-alignto center some text inside a container.
But then it becomes difficult to play with the width of the yellow div element. What for? (Iβm also interested .. if some property becomes ineffective for any element, when some others are turned on, the browser can mark them with a different color or cross them out .. Or will there be some drawbacks?)


.grey-footer-background {
background-color: #a8a7a5;
height: 70px;
border-bottom: 1px black solid;
padding-top: 8px;
display: table;
height: 100px;
width: 100%;
table-layout: fixed;
}
.gold_button {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
font-weight: bold;
text-align: center;
border-right: solid 1px #262626;
width: 80%;
height: 60px;
vertical-align: middle !important;
border: 1px solid black;
margin: 0 auto;
display: table-cell;
}
<div class="grey-footer-background">
<div class="gold_button"><span>Email</span>
</div>
</div>
Run codeHide result
source
share