Centering Text Vertically And Horizontally In A Div
I am using bootstrap and I am attempting to make a Cell that is 100% height and width of its host container. The title is 30% of that space and the value is 70%. There are upper an
Solution 1:
Making text central is fairly trivial, the easiest approach is as follows. You can check out the jsFiddle too: https://jsfiddle.net/jL9bs0j7/
.text-container {
height:200px;
width:400px;
border: 1px solid #000;
text-align: center;
}
.text-container span {
display: block;
position: relative;
top: 50%;
transform: translateY(-50%);
}
<div class="text-container">
<span>Hello World</span>
</div>
Post a Comment for "Centering Text Vertically And Horizontally In A Div"