During the last decades, fragmentation has become an important issue in ecological research. Habitat fragmentation operates on spatial scales ranging over several magnitudes from patches to landscapes. We focus on small-scale fragmentation effects relevant to animal foraging decision making that could ultimately generate distribution patterns. In a controlled experimental environment, we tested small-scale fragmentation effects in artificial sea grass on the feeding behaviour of juvenile cod (Gadus morhua). Moreover, we examined the influence of fragmentation on the distribution of one of the juvenile cod's main prey resources, the grass shrimp (Palaemon elegans), in association with three levels of risk provided by cod (no cod, cod chemical cues and actively foraging cod). Time spent by cod within sea grass was lower in fragmented landscapes, but total shrimp consumption was not affected. Shrimp utilised vegetation to a greater extent in fragmented treatments in combination with active predation. We suggest that shrimp choose between sand and vegetation habitats to minimize risk of predation according to cod habitat-specific foraging capacities, while cod aim to maximize prey-dependent foraging rates, generating a habitat-choice game between predator and prey. Moreover, aggregating behaviour in grass shrimp was only found in treatments with active predation. Hence, we argue that both aggregation and vegetation use are anti-predator defence strategies applied by shrimp. We therefore stress the importance of considering small-scale behavioural mechanisms when evaluating consequences from habitat fragmentation on trophic processes in coastal environments.