A layer of fine froth floated on top of the coffee.
Tips
memory
沫 has the water radical 氵 on the left, signalling liquid, and 末 (end; tip) on the right - foam sits at the very tip or end of liquid, hence the combination makes intuitive sense.
Water radical on the left marks this char as a water-surface phenomenon - bubbles and froth form on top of moving water. Same radical drives 海、河、泡 (bubble), 浪 (wave). The compressed three-drop form is the standard left-side water across the entire fluid-noun family.
末 supplies the sound exactly - mò with matching tone - making this a clean phono-semantic compound. Same 末 phonetic also drives 抹 (mǒ/mā, wipe) and 茉 (mò, jasmine). Mnemonic: foam sits at the surface tip 末 of water 氵.