Look at the end of any steel girder and you will see the same letter: I. Two wide plates joined by a thin wall. It looks like a way of saving money, and it is. But the strange part is that it saves steel without losing strength where it counts, and a girder that looks "thinner" is far stiffer than a solid bar with the same amount of metal.
Put a beam across a gap and load it in the middle. It sags. The top edge gets shorter, so it is squeezed. The bottom edge gets longer, so it is stretched. Somewhere in between is a line, the neutral axis, that does neither.
Steel near that line barely does anything. It is stretched or squeezed a little, so it pushes back a little. Steel far from the line is stretched or squeezed a lot, so it resists a lot. The metal that works hardest is the metal at the very top and very bottom.
Engineers measure how well a cross-section resists bending with a number called the second moment of area, written I. For a solid rectangle of width b and depth h:
I = b × h³ / 12
The depth is cubed. Take a plank and stand it on its edge so it is twice as deep and half as wide, and I does not double. It goes up by a factor of four. Stand a flat 160 × 25 mm board on its edge and it is more than 40 times stiffer, with exactly the same wood. A ruler flexes easily when laid flat and hardly at all when held on edge. Same ruler, same material.
The sag of a beam under a load in the middle is inversely proportional to E × I, where E is the stiffness of the material. For a beam resting on two supports a length L apart, with a force P in the middle, the sag is P L³ / (48 E I). Double I and you halve the sag.
Now the trick. If depth is what matters, why not use the metal only where it is far from the axis? Put most of it into two flanges, at the top and the bottom. Link them with a thin web, just enough to hold them apart and stop them sliding against each other. That is an I-beam.
Below is a beam with a fixed amount of steel: 4,000 mm² of cross-section, the same as a solid 63 mm square bar. You can reshape it however you like, but the area stays the same, so the weight stays the same too. Drag the handles, use the sliders or try the presets. The grey ghost is the sag of the solid square, for comparison. The beam is 2 m long, steel with E = 200 GPa and a 5 kN load in the middle (roughly the weight of half a tonne).
Drag the lime dots: the top one changes depth, the side one changes flange width. Total steel stays fixed.
Try pulling the web thickness down to the minimum with a deep, wide shape. The stiffness figure looks wonderful, but the real beam would not survive. The thin web can crumple under the load, and a slender flange can buckle sideways, which is the same family of failure that bends a squeezed ruler. So real I-beams are a compromise, with a web thick enough to stay flat and flanges wide enough to stay put.
There is also a limit in the other direction. An I-beam is stiff when bent in its tall direction, but it is much weaker if you bend it sideways, the way the flat plank above is. That is why girders are installed with the web upright.
Strength in bending is not about how much material you have. It is about where it is. Move the same steel away from the neutral axis and the beam gets stiffer without getting heavier. Tubes, box girders, corrugated roofing and the hollow bones of a bird all play the same trick.