Some materials do not transfer heat very well. They are poor conductors of heat and are called heat insulators. If you hold the bottom part of a long, lighted candle, you do not feel much heat coming through to your fingers, nor does the heat of the flame heat the candle up making it too hot to hold. Wax, wood, air, and paper are all poor conductors of heat and therefore good heat insulators. Polystyrene foam is used in houses for insulation of walls and in thermos bottles and ice chests.
Polystyrene is a form of plastic that is full of air bubbles. The air bubbles create an insulating barrier that reduces the transfer of heat from one side to the other. This foam is used to keep hot things hot and to keep cold things cold.
Insulation is measured in terms of its thermal resistance, which is the resistance of a material to heat flow. You often hear it referred to as the R-value of the insulation. The higher the R-value, the better the insulation is. In the northern U.S., it is recommended that the walls of a home have an R-value of 19, and the ceiling has R-38 insulation.
The photo below is a magnification of polystyrene foam.