On one side you have a bulb filled with some sort of alcohol (I think).
Then you have a band of mercury.
Then some more alcohol but the bulb at the other end is a bubble of air. This bubble becomes compressed at high temperatures as the alcohol at the other side expands.
On each side of the mercury is a glass rod with some very fine iron wire within it. A magnet behind the graduations holds the glass rods where the mercury leaves them, thus recording the maximum and minimum temperature. When you press the button to reset the thermometer, the magnet releases the glass rods which gravity then forces back to the level of the mercury.
There are other designs in which the glass rods are held within the tube by tiny hair-like springs, and when you reset the thermometer you use a magnet to pull the rods down again. The disadvantage of this design, as mu father found, is that your naughty little grand-daughter can take this magnet and drop it down the well.