When a comet nucleus approaches the Sun, it's heated - the ice at the surface of the nucleus melts, and jets of gas and dust are given off. There are two main types of comet tails. They are formed from the gas and dust given off by the nucleus. Most of the dust particles given off by the nucleus are tiny. So tiny is fact that they can be pushed about by the pressure of sunlight alone.
Sunlight pushes back the dust particles, forming a dust tail .
This tail can be seen remotely due to it reflecting sunlight. The gases given off by the nucleus become electrically charged by several processes, forming ions. There is a constant stream of charged particles flowing from the Sun at several hundred kilometres per second, called the solar wind. As soon as the gas particles are charged, they are under the influence of this wind, which carries them away from the Sun. The ion tail can be seen because the ions within it fluoresce.