Water vapor (H2O) is composed of one Oxygen atom and two Hydrogen atoms.
Hydrogen is the lightest element at 1 atomic unit while Oxygen is 16 atomic units.
Thus the water vapor atom has an atomic mass of 1 + 1 + 16 = 18 atomic units.
At 18 atomic units, water vapor is lighter than diatomic Oxygen (32 units) and diatomic Nitrogen (28 units).
Thus at a constant temperature,
the more water vapor that displaces the other gases,
the less dense that air will become.