Foam fire extinguishers are suitable for class A and the flammable liquids of class B, though not effective for gaseous fires.
They spray a type of foam that expands when it hits the air and blankets the fire. This blanket prevents the vapors from rising off the liquid to feed the fire, thus starving it of fuel. Also, because the foam is mixed with water, it has a cooling effect as well.
Foam extinguishers are some of the best for liquid fires, such as gasoline fires, but can also be used on Class A fires involving solid combustibles like wood.