How do covalent bonds form?
Covalent bonding arises from the fundamental idea that all elements want to achieve a stable configuration of an outer shell consisting of 8 electrons.
This can be achieved in different ways, but in the case of covalent bonding 2 atoms "share" their electrons with the other atom. This is especially seen among the halogens (group 7/17) where all the elements are said to be diatomic as they are made up of 2 atoms bonded together by covalent bonding. e.g
Note that this type of bondings is only possible between two elements considered as non-metals (between a metal and a non-metal the bond would be ionic) .Another famous example would be Carbon, which has 4 valence electrons. Methane,
In the diagram below you see that the crosses are the atoms that "belong" to the Carbon atom and the dots are atom belonging to the hydrogens, but they share them.