Many aspects of mammalian visual anatomy vary with activity pattern, reflecting the divergent selective pressures imposed by low light and high light visual environments. However, ambient light intensity can also differ substantially between and within habitats due to differences in foliage density. We explored the effects of interhabitat and intrahabitat variation in light intensity on mammalian visual anatomy. Data on relative cornea size, activity pattern, and habitat type were collected from the literature for 209 terrestrial mammal species. In general, mammalian relative cornea size significantly varied by habitat type. In within-order and across-mammal analyses, diurnal and cathemeral mammals from forested habitats exhibited relatively larger corneas than species from more open habitats, reflecting an adaptation to increase visual sensitivity in forest species. However, in all analyses, we found no habitat-type effect in nocturnal species, suggesting that nocturnal mammals may experience selection to maximize visual sensitivity across all habitats. We also examined whether vertical strata usage affected relative cornea size in anthropoid primates. In most analyses, species occupying lower levels of forests and woodlands did not exhibit relatively larger corneas than species utilizing higher levels. Thus, unlike differences in intensity between habitat types, differences in light intensity between vertical forest strata do not appear to exert a strong selective pressure on visual morphology. These results suggest that terrestrial mammal visual systems reflect specializations for habitat variation in light intensity, and that habitat type as well as activity pattern have influenced mammalian visual evolution.