There are three main types of galaxies: irregular galaxies with no defined shape, elliptical galaxies that are flattened balls containing only old stars, and spiral galaxies with a central bulge and rotating disk containing gas, dust, and younger stars. Stars form within giant clouds of gas and dust called nebulae, and their lifetime depends on their mass - smaller stars live much longer than larger ones. The universe contains these galaxies, nebulae, and stars, all bound together by gravity.