On smaller engines the connecting rod links the piston and the crank directly, but this transmits transverse forces to the piston, since the crankpin (and thus the direction the force is applied) moves from side to side with the rotary motion of the crank. These transverse forces are tolerable in a smaller engine; a larger engine's much greater forces would cause an intolerable degree of wear on the piston and cylinder, as well as increasing overall friction in the engine.
In the case of the steam engine, a crosshead is essential if the engine is to be double acting - steam is applied to both sides of the cylinder, which requires a seal on both ends of the cylinder.
A piston rod is attached to the piston and links it to the crosshead, which is a large casting sliding in crosshead guides (UK: slidebar), allowing it only to move in the same direction as the piston travel. The crosshead also houses the gudgeon pin on which the small end of the connecting rod pivots. In this way, the transverse forces are applied only to the crosshead and its bearings, not to the piston itself.
Internal combustion engines using crossheads make for easier maintenance of the top end of the engine, since the pistons can be easily removed. The piston rod is mounted on the underside of the piston and connected to the crosshead by a single nut.
Large diesel engines (such as those fitted to ships) often are of this pattern; the vast majority of steam engines are also built this way.
Crossheads in a steam locomotive can be mounted either to one guide mounted above the crosshead or to two, one above and one below (called an alligator crosshead since it has two "jaws"). The former was preferred in many modern locomotives.