Historically a cesium chloride (CsCl) solution was often used, but more commonly used density gradients are sucrose or Percoll. The sample is put on top of the solution, and then the tube is spun at a very high speed for an extended time, at times lasting days. The CsCl molecules become densely packed toward the bottom, so a continuous gradient of layers of different densities (and CsCl concentrations) form.  Since the original solution was approximately the same density, they go to a level where their density and the CsCl density are the same, to which they form a sharp, distinctive band.