Another way a nebula can form is when a star explodes, becoming a supernova. The supernova shoots billions of tons of material into space. The material gives off its own fluorescent lighting. After thousands of years the nebula loses its light. In 1054, a star exploded becoming a nebula which is now called the Crab Nebula and which is several light years across.
Most nebulae are capable of producing stars.
All nebulae contain the necessary components of a star. Such nebulae are called stellar nurseries. The Orion Nebula is an example of a stellar nursery. Dust in a nebula sometimes collects together becoming a larger mass that pulls in more and more particles and eventually becomes a star. In a nebula there are globules of matter floating among the dust particles.