here are two main types of fog:
Forms when quite warm, moist and stable air is blown across a cooler surface (land or water). The air temperature falls until the dew point is reached and condensation occurs.
Examples of advection fog include San Francisco.
This type of fog is a thin layer that forms because land cools down overnight. When the dew point is reached and condensation occurs, the fog moves slowly upwards. Radiation fog is common at lakes, harbours and in river valleys.