A superconducting object in a magnetic field levitates because it is trapped in place.
When a single crystal sapphire wafer coated with a ~1µm thick yttrium barium copper oxide is cooled below -185ºC the ceramic layer becomes a superconductor. Due to the Meissner effect, the superconductor will attempt to expel all the magnetic field from inside. As the superconductor is extremely thin, the magnetic field penetrates in discrete quantities called flux tubes. Inside each magnetic flux tube superconductivity is locally destroyed. The superconductor will try to keep the magnetic tubes pinned in weak areas (e.g. grain boundaries). Any spatial movement of the superconductor will cause the flux tubes to move. The resistance to movement offsets the force of gravity and traps the superconductor in place.