The Hydrogen lines are weaker in B stars because they are getting too hot for Hydrogen to exist in the right electronic state to create the Balmer lines. For cooler stars, F, then G, the stellar photosphere is too cool to create strong Balmer lines. Certain kinds of elements like (are strong in absorption) certain stellar temperature ranges.
A popular activity in most college astronomy classes is to come up with a mnemonic to remember the sequence. One of the first, which has stuck since the middle of the last century is:
Recall, we already had a method to estimate temperature of a star by studying its spectrum: Applying Wein's Law. The identification of atomic and molecular lines in the star is an even more powerful estimate for stellar temperature.