Little is known of how linkage patterns between species change along environmental gradients. The small, spatially discrete food webs inhabiting tank-bromeliads provide an excellent opportunity to analyse patterns of community diversity and food-web topology (connectance, linkage density, nestedness) in relation to key environmental variables (habitat size, detrital resource, incident radiation) and predators:prey ratios. We sampled 365 bromeliads in a wide range of understorey environments in French Guiana and used gut contents of invertebrates to draw the corresponding 365 connectance webs. At the bromeliad scale, habitat size (water volume) determined the number of species that constitute food-web nodes, the proportion of predators, and food-web topology. The number of species as well as the proportion of predators within bromeliads declined from open to forested habitats, where the volume of water collected by bromeliads was generally lower because of rainfall interception by the canopy. A core group of microorganisms and generalist detritivores remained relatively constant across environments. This suggests that (i) a highly-connected core ensures food-web stability and key ecosystem functions across environments, and (ii) larger deviations in food-web structures can be expected following disturbance if detritivores share traits that determine responses to environmental changes. While linkage density and nestedness were lower in bromeliads in the forest than in open areas, experiments are needed to confirm a trend for lower food-web stability in the understorey of primary forests.