They correspond due to the fact that certain elements are grouped together based on the number of valence electrons on the outer shell of their electron configuration.
For instance, sulfur (S) has 6 electrons in the outer shell, as it is in the 6th group EXCLUDING transition metals (note, never take these into account, as their charge is always +2; a cation)