If polar ice caps melting will flood the earth why doesn't an icecube melting overflow a glass of water?

this puzzles me. it would seem that if the polar ice caps melting would flood the earth, why doesn’t a glass overflow when icecubes melt. now this would only apply if the majority of the ice mass is underwater. and if it does melt, the sun being the hottest it has been in over 6,000 years could have something to do with it.