Quicksand is a colloid hydrogel consisting of fine granular material (such as sand or silt), clay, and water.
Quicksand forms in saturated loose sand when the sand is suddenly agitated. When water in the sand cannot escape, it creates a liquefied soil that loses strength and cannot support weight. Quicksand can form in standing water or in upwards flowing water (as from an artesian spring). In the case of upwards flowing water, seepage forces oppose the force of gravity and suspend the soil particles.
The saturated sediment may appear quite solid until a sudden change in pressure or shock initiates liquefaction. This causes the sand to form a suspension and lose strength. The cushioning of water gives quicksand, and other liquefied sediments, a spongy, fluidlike texture. Objects in liquefied sand sink to the level at which the weight of the object is equal to the weight of the displaced soil/water mix and the submerged object floats due to its buoyancy.
Liquefaction is a special case of quicksand. In this case, sudden earthquake forces immediately increase the pore pressure of shallow groundwater. The saturated liquefied soil loses strength, causing buildings or other objects on that surface to sink or fall.
[Read more on Wikipedia]