How do you center a div or anything else horizontally, so that on both sides the empty spaces are equal? And the div is exactly in the middle? No matter the size of the objects.
Take for example: the Stackoverflow site itself. Except for the black header on the top of this site, everything is in the middle and the empty spaces on both sides are equal to each other.
I've searched for a long time, but I only encountered the wrong answers or vague answers.
Please help and thank you!