Take margin/padding into header top positioning

Added a fix for header not taking margin and padding of parent table into account when assigning ’top’ positioning.