Plant distributions can be limited by habitat-biased herbivory, but the proximate causes of such biases are rarely known. Distinguishing plant-centric from herbivore-centric mechanisms driving differential herbivory between habitats is difficult without experimental manipulation of both plants and herbivores. Here we tested alternative hypotheses driving habitat-biased herbivory in bittercress (Cardamine cordifolia), which is more abundant under shade of shrubs and trees (shade) than in nearby meadows (sun) where herbivory is intense from the specialist fly Scaptomyza nigrita. This system has served as a textbook example of habitat-biased herbivory driving a plant's distribution across an ecotone, but the proximate mechanisms underlying differential herbivory are still unclear. First, we found that higher S. nigrita herbivory in sun habitats contrasts sharply with their preference to attack plants from shade habitats in laboratory choice experiments. Second, S. nigrita strongly preferred leaves in simulated sun over simulated shade habitats, regardless of plant source habitat. Thus, herbivore preference for brighter, warmer habitats overrides their preference for more palatable shade plants. This promotes the sun-biased herbivore pressure that drives the distribution of bittercress into shade habitats.