This diagram illustrates the basic idea of the greenhouse effect. Solar radiation passes through the atmosphere and heats the earth surface. The Earth radiates heat out into the atmosphere. Some of this heat continues on to space, while some as absorbed by the greenhouse gasses in the atmosphere.
Image courtesy of the Devon County Council