Two hydrogen atoms each have one proton and one electron. Bring them close and each electron is attracted to both nuclei. The lowest-energy arrangement puts the pair of electrons between the nuclei, where it holds them together like a shared anchor. Neither atom owns the pair; both count it as their own, so each hydrogen now has two electrons, a full first shell. That shared pair is a single covalent bond, drawn H–H.
Atoms share as many pairs as they need to fill their outer shell. Oxygen has 6 valence electrons and needs 2 more, so it forms 2 bonds, as in H–O–H. Nitrogen needs 3 and forms 3; carbon needs 4 and forms 4, as in CH4. Two atoms can share more than one pair: O2 has a double bond (2 pairs, 4 electrons) and N2 a triple bond (3 pairs, 6 electrons). More shared pairs make a shorter, stronger bond: 945 kJ/mol for N≡N against about 160 kJ/mol for N–N.
A covalent bond is strong even when the substance is soft or boils easily. Methane boils at −162 °C, but only because the attractions between separate CH4 molecules are weak; the C–H bonds inside each molecule (413 kJ/mol) survive boiling untouched. When covalent bonds run through a whole solid, as in diamond or quartz, there are no separate molecules to pull apart, so the solid is very hard and melts only at very high temperatures, about 1,700 °C for quartz. Sharing is also not always equal: when one atom pulls harder, the bond is polar covalent.
Think of it like this. Two climbers clipped to the same rope are a fair picture of a covalent bond: neither owns the rope, both are held by it, and the more ropes they share (single, double, triple), the harder they are to separate. The picture is off in one way: the shared electrons are not a line between the atoms but a cloud concentrated between the two nuclei.
Core idea. Two nonmetal atoms hold together by sharing pairs of valence electrons, each atom counting the shared electrons toward a full outer shell; the number of pairs shared sets the bond's length and strength.