The units of density are mass divided by volume (m/V). Density will increase if either mass increases while the volume remains constant or if volume decreases while mass remains constant.
Density of air will vary as the temperature and moisture content in the air varies. When the temperature increases, the higher molecular motion results in an expansion of volume and thus a decrease in density.
The amount of water vapor in the air also effects the density. Water vapor is a relatively light gas when compared to diatomic Oxygen and diatomic Nitrogen. Thus, when water vapor increases, the amount of Oxygen and Nitrogen decrease per unit volume and thus density decreases because mass is decreasing.
The two most abundant elements in the troposphere are Oxygen and Nitrogen. Oxygen has an 16 atomic unit mass while Nitrogen has a 14 atomic units mass. Since both these elements are diatomic in the troposphere (O2 and N2), the atomic mass of diatomic Oxygen is 32 and the diatomic mass of Nitrogen is 28.
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.
You may be familiar with the concept that moist air is less dense than dry air. This is true when both have the same temperature or when the moist air is warmer. Said in another way, air with a greater percentage of water vapor will be less dense than air with a lesser percentage of water vapor at the same temperature. Often people erroneously believe that moist air is denser than dry air because very moist air is more difficult to breathe than dry air.