Like most physicists, I have a soft spot for Galileo thermometers.
A Galileo thermometer* works because the density of water changes as its temperature changes. The mass of a substance remains constant as it is heated (because the number of atoms doesn’t change) but because those atoms move faster the volume increases and therefore the density decreases, as shown in the graph for water below.
As the water inside the thermometer is heated by its environment its density decreases and the more dense bubbles, that represent lower temperatures, are then more dense than the surrounding fluid and therefore sink. The Galileo thermometer is read by reading the temperature tag of the bubble closest to the middle of the cylinder.
The density of the bubbles inside the thermometer is set by altering the size of the metal tags attached to them: the bubbles that represent higher temperatures have smaller tags and therefore lower densities. (The overall density of the bubble does not change as it is heated because the overall density of the bubble depends only on its overall mass and overall volume, and as the liquid inside a bubble expands it merely compresses the air inside that bubble.)
* Not actually invented by Galileo, but by a group that included one of his students.