We can use flexbox to do this. #parent is the container element inside which to center the #child element.

#parent {
    display: flex;
    justify-content: center;
    align-items: center;
}