Chemical bonds are how atoms connect to other atoms, forming matter. These bonds are created when valence electrons - electrons in the outer shell of an atom - interact. Electrons repel one another, but are attracted to the protons in the center of atoms. This results in atoms connecting together. There are two main types of bonds: covalent bonds and ionic bonds. Metallic bonding is a specific type of bonding occurring between atoms of metallic elements.
Ionic bonds are formed when an atom either donates or accepts one or more electrons from another atom. When an atom loses an electron it becomes a cation, a positively charged ion. The atom that gains the electron also gains a negative charge, becoming an anion. The oppositely charged ions are then attracted to one another, creating the bond. Positive and negative ions are attracted to one another and create electrostatic forces, just like oppositely charged magnets being pulled together. Ionic compounds can only occur between two different kinds of atoms. Atoms of the same element cannot form ionic bonds.
When electrons are shared between two atoms a covalent bond is formed. Atoms like to form octets of electrons, and they accomplish this by sharing pairs with other atoms. The negatively charged electrons are attracted to the protons of the other atom, while at the same time, the electrons and protons of each atom repel one another, respectively. Again, in the same manner of magnets repelling one another. The repelling forces are minimized by the spin of the electrons around the axis of the atom allowing the bond to form. When the atoms involved in the molecule do not share the electrons equally the bond is known as a polar covalent bond. Water (H2O) is an example of a polar covalent bond. The electrons of the water molecule are pulled closer to the oxygen atom than either hydrogen.
Salt (NaCl) is formed by an ionic bond between sodium (Na) and chlorine (Cl), while chlorine gas (Cl2) displays a covalent bond. Metals react with nonmetals to form ionic bonds. The electronegativity of an atom determines how strongly it will pull electrons. Electronegativity increases up the periodic table and to the right, with the most electronegative element being fluorine.
If the two atoms involved are metallic elements the bond is a metallic bond. Metallic bonding is neither ionic nor covalent, per se. Single metallic bonds do not exist, but metals bonding together does happen. The interaction is an electromagnetic one between delocalized electrons. Metallic bonding is what causes many of the unique properties of metals. Not all metals will exhibit the tendency to engage in metallic bonding.