Why does the temperature remain constant during melting and boiling although heat is being absorbed from the surroundings?
Heat is being added to ice as it melts, but that heat is going
into turning the water from a solid into a liquid (breaking
intermolecular bonds), rather than increasing the temperature. This
is also true when it boils, and that is why a boiling pot of water
won't reach a higher temperature than 100 °C.
When something changes phase from solid to liquid, or from liquid
to gas, it takes energy to break the intermolecular interactions.
These interactions between the water molecules are what make it
solid. When you have ice, these interactions are strongest, which
is why ice is hard. Then when you have water, the interactions are
not as strong, and although the water still "stays together" it is
now a liquid and moves and flows freely. Then when all the
interactions are broken, it become a gas, or steam, and now none of
the water molecules are attached to any other molecules. Whenever
it goes through a phase change like this, the energy goes into
breaking up these interactions, and so the temperature stays
constant until all the interactions are broken. Once all the ice is
melted, or all the water has turned to steam, then any added heat
will act to raise them temperature again.
See the Web Links to the left for more information about phase