hydrogen and helium
The gas giants are mostly made of hydrogen and helium. These are the same elements that make up most of the Sun. Astronomers think that most of the nebula was hydrogen and helium. The inner planets lost these very light gases. Their gravity was too low to keep them and they floated away into space. The Sun and the outer planets had enough gravity to keep the hydrogen and helium.