Gravity is a function of mass, so if there is no mass nearby, there will be no gravity. By 'nearby', I am talking about within several hundred billion miles. The gravity field of our sun extends well beyond the orbit of Pluto, a distance of several billion miles. However, a space capsule in orbit around a body will give the illusion of zero gravity because it is constantly falling around the body it is orbiting. Gravity is constantly pulling the capsule toward the center of the planet, but the velocity of the capsule causes it to fall in a curve. The curved trajectory means that the planet is constantly curving away from the capsule, so it is in 'free fall', and the occupants will have no sensation of weight.