Each sphere in the thermometer has an average density of molecules that is really close to that of the water in the tube. If the sphere's average density is less than the water, it floats. Otherwise it sinks. As the temperature changes and the water molecules move further apart, the spheres have more trouble floating. Each sphere is carefully adjusted so that it will begin to sink as soon as the temperature exceeds the value written on its side.
Most Galileo thermometers are accurate to within a few degrees.
It should be noted that Archimedes, the ancient Greek who figured this out, was probably a very strange fellow. He discovered the principle that bears his name one day while playing with toy boats in the bathtub. Those Greeks really knew how to party. Jack Valko directs the information systems group at Avenue A Media in Seattle. The Answer Geek appears on Mondays and Thursdays.