When cool, humid air is trapped beneath a layer of warmer air, a fog is formed.