Thermal expansion: most substances expand when heated, and contract when cooled. This happens because as the atoms/molecules get hotter, they move faster, hit each other harder, and bounce off each other further, leaving more space between the atoms/molecules.
As the temperature increases, the atoms move faster, hit harder, bounce further off each other, and the space between them increases. This causes the object to expand.
Convection is the upward movement of hot fluids (gas or liquid) and the downward movement of cold fluid due to density differences caused by thermal expansion (as fluid is heated its atoms move apart, making it less dense, so it floats upward).
As the temp goes up, the volume increases, so the density decreases. This makes the substance buoyant and it floats upward.
Density = mass
As the temp goes down, the volume decreases, so the density increases. This makes the substance sink.
Volume
Most thermometers work on the principle of thermal expansion. The liquid expands when heated and moves up the neck of the thermometer. As it cools, it contracts and moves down.