Nebula is cloud of gas and dust

Nebula is an interstellar cloud of dust, hydrogen, helium and other ionized gases. It is the name for any diffuse astronomical object, including Galaxies beyond the Milky Way. For instance, the Andromeda Galaxy, also called the Andromeda Nebula. Most of them are huge in size, hundreds of light years in diameter, denser than the space that surrounds them. These are often regions of Star formation such as the Pillars Of Creation in the Eagle Nebula.
In these regions there is a gas, dust and other materials that are collected together and form larger masses. That attract additional material and eventually become massive enough. In the middle of the gravitational collapse of gas forming Nebulas and Stars. Remaining materials form the Planets and other objects of planetary systems.
Some are formed as a result of Supernova explosions. In fact, the death of massive short lived Star. The ejected material from the Supernova explosion are ionized by the energy and created the compact object. Other can be formed as a Planetary cloud. The final stage of the low mass Stars like the Earth’s Sun. Stars mass of 8 to 10 solar masses evolve into red giants. Slowly lose their outer layers during pulsations in their atmospheres. While the Star loses enough material it’s temperature rises. It's emitted ultraviolet radiation can ionize the surroundings, that was ejected.
Nebula fall into four main groups:
- H II Regions, huge diffuse Nebula containing ionized hydrogen. Cloud of low density, in which the formation of the Star recently begun.
- Planetary Nebula, which emits light of different colors. Comprises a foaming incandescent shell of ionized gas. Emitted from old giant Red Star, later in their life.
- Supernova Remnant, structure resulting from the explosion of massive Stars. The rest of the expanding shock wave border and consists of the material ejected from the explosion.
- Dark Nebula, a type of interstellar cloud is so dense it obscures the light from objects behind it. For instance, like background stars or reflection Nebula.