Each galaxy is held together by strong gravitational forces. Even if you managed to get away from our sun, you would still experience the galaxy's gravity. This image is an artisitic rendition of our galaxy. Public Domain Image, source: Christopher S. Baird.
There is gravity in space โ lots of it. Gravity is everywhere. It is true that as you get farther from the earth, its gravitational pull weakens. But it dies off quite slowly (compared to nuclear forces). And gravity never goes completely away. When you get very close to some other large body; the moon, Mars, or the sun; its gravity dominates over that of the earth. Only then can you neglect earth's gravity. Because gravity is everywhere in space, objects in space are always falling: towards the earth, towards the sun, and towards the galactic center. There are two reasons that objects seem to be floating without gravity in space when they are really falling.
First, space is very large and relatively empty by earth standards. When you jump off a bridge, you know you are falling because you feel the air whooshing up, see the mountains shooting up, see the water fast approaching, and then feel yourself hit the water. Because space is relatively empty, there is little air to feel whooshing past you as you fall and there are no landmarks to indicate you are moving. Because space is so large, it takes you from hours to years of falling through space until you actually hit the surface of a planet (assuming you have aimed properly so that you actually do hit), instead of the seconds it takes jumping off a bridge.
The second reason that gravity is not so obvious in space is because objects tend to orbit planets instead of hitting them. Orbiting just means that an object falls towards a planet due to gravity and continually misses it. Because space is so large and planets are so small by comparison, it's actually very hard to hit planets. Space objects typically slingshot in hyperbolic paths around planets, or slip into orbits around them. It takes a team of scientists doing very accurate calculations to make sure a space probe destined for the surface of Mars doesn't miss it. Falling in circles around a planet instead of smashing into it doesn't seem like the gravity we're used to on earth, but it's the exact same kind of falling. Astronauts in orbit around the earth are not experiencing "no gravity". They are experiencing almost all of earth's gravity, but with nothing to stop them. This is known as "free fall". Free fall looks like floating to a person in the falling frame of reference. Confusingly, scientists refer to an orbiting environment as "microgravity". What they really mean is "micro acceleration", which is another term for free fall. This unfortunate naming convention arises from the fact the word "gravity" is used historically to mean any acceleration, and not just gravity. For example, when an accelerating drag racer experiences four g's, the acceleration is due to the spinning tires and has nothing to do with gravity.
This drawing shows the sun and Mercury with their distance and sizes to scale (the size of Mercury was rounded up to one pixel to make it visible). Considering that Mercury is the closest object to the sun, you can see that space is a very empty place (at least as far as planets go โ in terms of particles and fields, space is not empty). For this reason, falling in space looks like floating. Public Domain Image, source: Christopher S. Baird.