position absolute: Pseudo Element zentrieren

CSS
.hauptelement {
    position: relative;
    height: 100vh;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hauptelement::before {
    content: "";
    position: absolute;
    background: url('path_to_your_image.jpg') no-repeat center center;
    background-size: cover;
    width: 50px; // Adjust as needed
    height: 50px; // Adjust as needed
    left: 50%; // important
    top: 50%; // important
    transform: translate(-50%, -50%); // use the important values in here
}