Beer Foam behavoir

So I pour some beer into a glass… a “head” forms a little too quickly so I quit pouring… How/why does the head “stop” when it reaches the rim of the glass? I have seen this quite a few times… more often by far than the “head” spilling over the top?

FML

My guess would be that the foam acts like a fluid with surface tension (to a good approximation) and forms a meniscus. You’re left with a slight bulge of foam above the level of the top of the glass, but it doesn’t spill over.

It might also have to do with how a fan will have a higher velocity on the side it’s blowing towards because it’s forcing the air through a smaller cross section than the air it’s pulling in. When the liquid is still in the glass, the pressure from the carbon dioxide coming out of solution is pushing the bubbles up. When it reaches the top of the glass, that gas isn’t as directed, and begins to scatter in all directions. Less pressure (same force, but over a larger area) means that the weight of the foam overcomes the force of the gas pushing it up. Just a WAG.