What caused terrestrial planets to form with rocky compositions while gas giants became rich in hydrogen and helium?

Answer

High temperatures in the inner nebula prevented gas accumulation

In the inner regions of the protoplanetary disk, the temperatures were too high for volatile gases like hydrogen and helium to condense or be captured by developing planetesimals. Only solid, heat-resistant materials like metals and silicates could form the building blocks of the inner planets, leading to their rocky, terrestrial nature. In the outer regions of the disk, the environment was cold enough for these volatile gases to accumulate, allowing the larger planetesimals in those areas to capture and retain massive envelopes of hydrogen and helium before the young Sun's solar wind cleared the remaining gas from the system.

What caused terrestrial planets to form with rocky compositions while gas giants became rich in hydrogen and helium?
forcegravitystarcollapsesolar nebula