If the sun is only hydrogen and helium (no solid objects like dirt or rocks) then why is its gravity so extreme? Mass determines gravity

The gravitational force of the Sun is indeed influenced by its mass, which is primarily composed of hydrogen and helium. Gravity is a fundamental force in the universe, and its strength depends on the mass of an object. The Sun's mass is approximately 333,000 times that of Earth, accounting for about 99.86% of the total mass of our solar system. The intense gravity of the Sun is a result of the immense concentration of mass within it. The process that generates this gravitational force is nuclear fusion occurring at the Sun's core. In the Sun's core, temperatures and pressures are so extreme that hydrogen atoms undergo fusion reactions, converting into helium and releasing an enormous amount of energy. This energy, in the form of light and heat, is what makes the Sun shine. The mass lost during these fusion reactions is converted into energy, following Einstein's famous equation, E=mc^2. The concentration of mass in the Sun is critical for its gravitational pull. Gravit...