What stars are made of is determined through the help of spectroscopy.
This involves the study of a star’s spectrum which is created by the electromagnetic radiation that it emits. Spectroscopy can not only derive the chemical composition of distant stars and galaxies, but can also determine their temperature, density, mass, luminosity and relative motion.
Stars emit at all wavelengths across the electromagnetic spectrum, along with many discrete absorption lines at certain wavelengths. These lines, which appear black on a colourful emission spectrum, result from a deficiency of observed photons at those particular wavelengths since its light is absorbed. It is these absorption lines that tell astronomers the composition of the star. Some stars have spectra patterns similar to the Sun, while others are slightly different. However, in general the make-up from star to star is generally very similar.
In the absorption spectrum of our Sun we see prominent absorption lines relating to hydrogen and helium along with other trace elements. Two lines of hydrogen can be found in the fingerprints of our star. However, the star Vega, in the constellation Lyra, might have these two lines but they are much thicker and more intense owing to the star’s temperature.