The physical structure of the environment may be especially important to bacteria, which can live as free-floating cells or form dense aggregations on solid surfaces. The present study asks whether inhabiting structurally different environments promotes the evolution of distinct adaptations. A total of two experimental habitats were arranged: in the homogeneous one the cells were free-floating and mixed; in the structured one they grew undisturbed, forming layers on a solid medium. The populations were propagated through 1000 generations. Then the fitness of the evolved clones was compared with that of their common progenitor clone. The derived clones were most fit in the environment in which they had evolved, but their fitness was enhanced also in the structurally unfamiliar environment. This could mean that the bacteria adapted not only to the habitat structure but also to nutritional conditions, which were the same in both selection environments. For this reason, the fitness measurements were repeated in a different growth medium. Now the bacteria that had adapted to the homogeneous habitat demonstrated a significant loss of fitness in the non-homogeneous one, and vice versa, suggesting that evolutionary specialization may result in fitness trade-offs. In this way the origination of environmental generalists might be impeded. Another broad finding was that variation in fitness was higher among clones evolved in the structured habitat, implying that evolution in a non-homogeneous environment produces a greater diversity of adaptations.