A foam is a substance that is formed by trapping pockets of gas in a liquid or solid. A bath sponge and the head on a glass of beer are examples of foams. In most foams, the volume of gas is large, with thin films of liquid or solid separating the regions of gas.
An important division of solid foams is into closed-cell foams and open-cell foams. In a closed-cell foam, the gas forms discrete pockets, each completely surrounded by the solid material. In an open-cell foam, the gas pockets connect with each other. A bath sponge is an example of an open-cell foam: water can easily flow through the entire structure, displacing the air. A camping mat is an example of a closed-cell foam: the gas pockets are sealed from each other so the mat cannot soak up water.
Foams are examples of dispersed media. In general, gas is present in large amount so it will be divided into gas bubbles of many different sizes (the material is polydisperse) separated by liquid regions which may form films, thinner and thinner when the liquid phase is drained out of the system films. When the principal scale is small, i.e. for a very fine foam, this dispersed medium can be considered as a type of colloid.
The term foam may also refer to anything that is analogous to such a foam, such as quantum foam, polyurethane foam (foam rubber), XPS foam, polystyrene, phenolic, or many other manufactured foams.