An annual of light, dry, sandy or gravelly soil. Coastal habitats include open grassland, fixed dunes, sandy banks and sheltered rock crevices. Inland, it occurs in a range of open habitats, including dry grassland, by paths, on wall-tops, road verges and railway ballast. 0-455 m (Dalnaspidal, E. Perth).
There has been no change in the coastal distribution since the 1962 Atlas. It has declined in many inland railway sites, which it colonised during the Second World War, but this seems to have been offset to some extent by recent records from salt-treated roadsides. It has not been possible to distinguish alien from native records inland and all are mapped as if they were native.
European Temperate element.