auto calculate span of columns