Differences in the width and clarity of absorption lines of stars can indicate differences in density. The absorption lines of a white dwarf are much broader than those of a blue giant. A white dwarf can be 100,000,000 times denser than a blue giant.
Credits
Illustration
NASA, ESA, Leah Hustak (STScI)