The Galileo thermometer consists of a vertical glass tube, typically filled with water, and sealed glass bubbles containing coloured water or alcohol. Each bubble is also attached to a specific mass (labelled with the temperature it represents) to calibrate its density (the amount of mass in a given volume). The temperature can be read by interpreting the distribution of these bubbles. The principle of buoyancy states that if an object is less dense than a liquid, it floats; and if the object is denser than the liquid, it sinks.
When the temperature of the liquid in the glass tube begins to warm up, it expands; hence lowering the density of the liquid, as its mass now occupies a larger volume. The opposite occurs when the temperature cools (ie density of the liquid increases). Therefore, if a bubble becomes denser compared with the liquid, it sinks; and if less dense, it floats.