Stratigraphy is the study of layers, and the principle that where deposits lie undisturbed the lower ones were laid down before the upper ones. It sounds trivial. It is the foundation on which both geology and archaeology built their sense of time, and before it there was no reliable way to order the past at all.
Nicolas Steno set out the core rules in the seventeenth century. Superposition: in an undisturbed sequence, lower is older. Original horizontality: sediments are deposited roughly flat, so tilted strata were tilted after deposition. Lateral continuity: a layer extends until it thins out or meets an obstacle. Cross-cutting relationships add that anything intruding through a layer, a pit, a wall footing, a fault, is younger than what it cuts.

William Smith, a canal surveyor, made the method predictive by observing that particular fossil assemblages appear in a consistent order wherever the rocks are found, so strata could be correlated across distances and mapped. His geological map of England and Wales in 1815 was the first of its kind, and the same logic underpins the geological time scale.

Archaeology adopted the approach in the nineteenth century and refined it considerably. The decisive step was Mortimer Wheeler's insistence on recording layers rigorously rather than digging for objects, and the later development of the Harris matrix, which represents every deposit and every cut as a node in a diagram of what preceded what. This lets an excavator reason about sequence even where a site has been dug into, robbed, and rebuilt repeatedly, which most sites have.
Stratigraphy gives relative sequence: this before that. It does not give calendar dates. Absolute dating requires something else, radiocarbon, dendrochronology, luminescence, or a datable object such as a coin, and the two are used together. That is why excavation is destructive in a way that matters: the sequence exists only in the ground, and once a site is dug the record of it is whatever was written down at the time.
The method also carries a standing caution. Layers are disturbed by burrowing animals, ploughing, later construction, and deliberate backfill, and an artefact can be older than the deposit containing it or intrusive from a later one. Interpreting a section is therefore an argument about formation processes rather than a simple reading of order, which is why two competent excavators can disagree about the same trench.