Gravity is defined as the force that attracts objects towards the center of the Earth, or any other physical object that has mass.
Gravity is affected by two variables. These variables are distance and mass.
Distance is inversely proportional (as one goes up, the other goes down) to the strength o gravity. In other words, the greater the distance between two objects, the lower the strength of gravity is between them.
On the other hand, mass is directly proportional (as one goes up, the other goes up/ as one goes down, the other goes down) to gravity. Weight is actually the measurement of gravity. This is why people weigh more on Earth than on the moon. The amount of matter within a person does not change whether on Earth or the moon. However, because Earth is larger (has a greater mass), its gravitational pull is greater on a person.