Many stars are classified in terms of brightness, or spectra that is the elements that they absorb.
Stars are classified according to characteristics of their spectra. They're separated into spectral classes according to their pattern and strength of absorption lines in their optical spectra. Spectral classes normally a sequence of surface temperature.