As you are not specifying any width for the elements, they are sized according to their content. As such, when the font-weight is normal, the element takes up less space than when it is bold. As the content changes size, the size of the box also changes.
You can specify the width of the element so that it slightly bigger than it's content or alternatively use a different method for identifying the currently active tab.