centering css ing 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: how to make things center using css
// add to the parent element
.parent{
height:100vh;
display:flex;
justify-content: center;
align-items: center;
}