Answers for "center text in midle of div"

3

how to set text to middle in div

.center {
  margin: auto;
  width: 50%;
  border: 3px solid green;
  padding: 10px;
}
Posted by: Guest on July-14-2020
0

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;
}
Posted by: Guest on February-26-2021

Browse Popular Code Answers by Language