What happens when comets come near the sun?

A comet's tail lengthens as it approaches the sun due to greater solar winds. A comets tail always faces away from the sun.