how to align text in div code example
Example 1: css center text in div
parent-element {text-align:center;}
parent-element {position: relative;}
element-to-be-centered {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
Example 2: center text in css
.class {
text-align: center;
}
Example 3: how to make a division center css
position:absolute;
top:50%;
left:50%;
transform:translate(-50%,-50%);
Example 4: css text align center
body {
text-align: center;
}
Example 5: put text in center of a div
html, body {
height: 100%;
}
.parent {
width: 100%;
height: 100%;
display: table;
text-align: center;
}
.parent > .child {
display: table-cell;
vertical-align: middle;
}