Early tubular spirit levels had very slightly curved glass vials with a constant inner diameter at each viewing point. These vials are incompletely filled with a liquid, usually a coloured spirit or alcohol, leaving a bubble in the tube. They have a slight upward curve so that the bubble naturally rests in the centre, the highest point. At slight inclinations, the bubble travels away from the marked centre position. Where a spirit level must also be usable upside-down or on its side, the curved constant-diameter tube is replaced by an uncurved barrel-shaped tube with a slightly larger diameter in its middle.
Alcohols such as ethanol are often used rather than water. Alcohols have low viscosity and surface tension, which allows the bubble to travel the tube quickly and settle accurately with minimal interference from the glass surface. Alcohols also have a much wider liquid temperature range, and won't break the vial as water could due to ice expansion. A colourant such as fluorescein, typically yellow or green, may be added to increase the visibility of the bubble.
A variant of the linear spirit level is the bull's eye level: a circular, flat-bottomed device with the liquid under a slightly convex glass face with a circle at the centre. It serves to level a surface across a plane, while the tubular level only does so in the direction of the tube.
Old Stonemasons Rambling: Box Levels are often used by Stonemasons and Ceramic Tilers to screed (Mud) floors. Look after and constantly check your level for accuracy, half a millimetre out in 1.2 mts is centimetres at 10meters. Don't clean the vial on your level with a scrubbing brush, if the vial is obstructed by dry cement a very very watered down solution of soldering flux will restore. Use PPE and irrigate the level immediately.