h1 and h2 are block level elements so by default they are 100% wide. Instead of all of the complex calculation, simply use text-align: center;
h1
h2
text-align: center;
2.1m questions
2.1m answers
60 comments
57.0k users