both alkali metals and halogens is the chemistry of loosing and gaining the electrons. Since the alkali metals and halogens comes under 1st group and 17th group, they have one electron and seven electrons in the outermost shell. Alkali metals lose an electron to gain valency +1 and halogens gain an electron to attain -1 valence. In this way, both posses same valence number but one looses and one gains. Hence this is also the major reason for the attraction of these elements.