The various elements are formed from these fusion reactions and the reactions occurring during the supernova explosion. The NY Times had a special issue on the Best of the Millenium. This leads to the decreasing size of the atoms. The greater nuclear charge plus smaller distance between electrons and protons results in a greater attraction for electrons going from left to right. Atoms on the left tend to lose electrons easily those towards the right tend to gain electrons.
Electronegativity is a way of expressing the pull on electrons between atoms in a molecule.
An atom with a higher electronegativity will generally pull negative charge from a neighbor with a lower electronegativity. It will be sufficient to just remember that Carbon and Hydrogen have roughly equal electronegativities, Nitrogen has a greater electronegativity than both C and H and Oxygen's electronegativity is greater still. Na K Mg anc Ca usually form salt structures when they are not disolved as ions.