Here is a picture of three German beer steins of the kind people drink from at Oktoberfest and other German festivals:
It's interesting to note that they all have a self closing metal lid on them.
That requirement for the metal lid dates back to the middle ages when the Black Death (the Bubonic Plague) was sweeping across Europe. At the time, no one knew what caused people to become sick and die from the plague, but in Germany there was speculation that it was caused by flying insects. People noted that small flying insects would be found in the partially dried up beer on the inside of a beer stein, and they speculated that swallowing those dead or dying insects caused people to become sick with the plague. This was a time before indoor plumbing. People would have to fetch water from a well to do any washing, and often those wells weren't close by. So, people didn't bother washing things, like beer steins, after each use like they do today.
To protect the population from the spread of the plague, the German government at the time passed a law requiring all beer steins to be fitted with reclosable metal lids which would keep flying insects out of the beer. And, German beer steins still have those reclosable metal lids today.