Explain how does green house effect cause global warming?

Visible light from the sun reaches the earth and heats it up. However, when the earth cools, the energy is re-emitted from the earth's surface in the form of infrared radiation which have longer wavelength and heating effect.
These infrared radiation can be absorbed by CO2 and H2O vapours. The heat thus absorbed is radiated back to the surface of the earth. In this way, warming of the earth occurs.
If the rate at which solar energy is arriving the earth remains constant but the amount of CO2 in the air increases, the heat radiated back to the earth will increase. Consequently, the temperature of the earth's surface will increase.
Hence, global warming depends on the concentration of those gases which are responsible for green house effect.