Away from the ground, there is no ground surface for condensation to form
on. However, there are numerous aerosol particles in the air that can provide
this service.
Only a fraction of these aerosol particles can serve as nuclei on which droplets of water or crystals of ice can condense. Salts, such as sea salt or table salt (NaCl, or sodium chloride) are effective nucleants of droplets. Non-water-soluble particles, such as soil particles, can nucleate ice crystals.
The next trick for producing cloud
droplets and ice crystals is getting the air to cool sufficiently for condensation
to take place. For fog and dew, the ground serves to cool the air by conducting
heat from the air, or it warms the air and lets it mix with cooler air. Given
that clouds form above the ground during the daytime, it's not that the air
loses infrared radiation to space (nor is it that the air is cooled by being
in contact with something solid, because there are no solid surfaces to cool
the air and aerosol particles don't count), nor can it involve a transfer of
heat (since air is a poor conductor, and above the ground, the air is only in
contact with more air.