Evolutionary responses to environmental change require heritable variation in traits under selection. Both heritability and selection vary with the environment, and may also covary, meaning that environmental variation can be an important source of evolutionary constraint. However, estimates of heritability and selection along environmental gradients in the field are rare. We estimated environmental variation in selection on three traits (cold tolerance, heat tolerance and wing size) of the rainforest fly Drosophila birchii by transplanting flies in cages along two elevational gradients in north-east Queensland, Australia, and calculating the genetic covariance of trait values with cage productivity at each elevation. We estimated heritability of each trait from laboratory crosses, and environmental variation in heritability of wing size from the correlation of mothers and daughters in cages at each elevation. We then used estimates of selection and heritability to predict selection responses along the elevation gradients. Laboratory assays revealed low-moderate genetic variation in all traits and low covariation among traits, suggesting the potential for a strong response to selection. Estimated selection responses predicted divergence of cold tolerance with elevation at one gradient. However, this was not observed at either gradient, with no difference between high and low elevation populations for this trait. Despite substantial variation in heritability (and predicted selection response) of wing size, this appeared random with respect to elevation, preventing overall divergence and suggesting that local environmental variation constrains evolutionary responses along natural ecological gradients. Such an effect, if widespread, may significantly slow evolutionary responses to environmental change.