I study how the contact area and the work of adhesion, between two elastic solids with randomly rough surfaces, depend on the relative humidity. The surfaces are assumed to be hydrophilic, and capillary bridges form at the interface between the solids. For elastically hard solids with relative smooth surfaces, the area of real contact and therefore also the sliding friction, are maximal when there is just enough liquid to fill out the interfacial space between the solids, which typically occurs for dK ≈ 3hrms, where dK is the height of the capillary bridge and hrms the root-mean-square roughness of the (combined) surface roughness profile. For elastically soft solids, the area of real contact is maximal for very low humidity (i.e., small dK), where the capillary bridges are able to pull the solids into nearly complete contact. In both case, the work of adhesion is maximal (and equal to 2γcosθ, where γ is the liquid surface tension and θ the liquid-solid contact angle) when dK >> hrms, corresponding to high relative humidity.