aligning in the center in css code example
Example 1: css centering
// grid
.parent {
display: flex;
align-items: center;
justify-content: center;
}
//flex box
.parent {
display: flex;
align-items: center;
justify-content: center;
}
// position
.parent {
position: relative;
}
.child {
position: absolute;
left: 50%;
right: 50%;
transform: translate(-50%, -50%);
}
Example 2: css center alignment
.center {
text-align: center;
border: 3px solid green;
}