Evolutionary shifts from one habitat type to another can clarify selective forces that affect life-history attributes. Four lineages of snakes (acrochordids and three clades within the Elapidae) have invaded marine habitats, and all have larger offspring than do terrestrial snakes. Predation by fishes on small neonates offers a plausible selective mechanism for that shift, because ascending to breathe at the ocean surface exposes a marine snake to midwater predation whereas juvenile snakes in terrestrial habitats can remain hidden. Consistent with this hypothesis, snake-shaped models moving through a coral-reef habitat in New Caledonia attracted high rates of attack by predatory fishes, and small models (the size of neonatal terrestrial snakes) were attacked more frequently than were large models (the size of neonatal sea snakes). Vulnerability to predatory fishes may have imposed strong selection for increased offspring size in marine snakes.