The colder a liquid is, the more dense it becomes. The molecules in colder liquids are closer together than in warmer liquids. For example, in frozen water, the molecules are so close together the water becomes a solid. In steam, the water molecules are so far apart they become a vapor.
Less dense objects float on top of more dense objects. For example, a less dense object -- such as a piece of popcorn -- will float on water more easily than a rubber ball will, even if they are the same size. The same is true of liquids with different densities; the denser liquid will sink. In any contained body of water -- from a beaker to the ocean -- the more dense water will be at the bottom of the container. Objects will also be more likely to float in a high-density liquid such as corn syrup than a low-density liquid like water. In a container where dense and less dense liquids are layered, objects will often float between the two layers.
For an easy experiment demonstrating the effect of temperature on liquid density, measure two equal amounts of water. Place one amount of water in a glass container in the freezer;chill until cold but not frozen. When it is cold, microwave the other measure of water for a few seconds to warm it slightly. Mix a few drops of blue food coloring into the cold water and an equal amount of red food coloring into the warm water. Very slowly and with as little force as possible, pour the red water into the jar with the blue water. If you pour carefully, the red water will be suspended over the blue water. If you pour too quickly, the liquid molecules will mix, warming and cooling to reach a temperature equilibrium.
The density of the ocean is affected by two primary factors: salinity and temperature. Because it is cooler and saltier, sea water is more dense than fresh water. In fact, when freshwater and saltwater sources mix, they will often remain clearly delineated, mixing slowly or not at all. Pure water's density is 1000 kg/m3; at the ocean's surface, salt water's density is approximately 1027 kg/m3. In the ocean, water circulation is horizontal, so water moves in layers of density. The ocean is also an unusual example of density because temperature affects water more strongly than salinity -- so high-salinity water can actually float on lower-salinity water if it is warmer than the water below it.