before getting label width set display to inline-block to resolve wrapping labels