Did you know…
How does gravity form in space?
Short answer
Gravity is not formed in space; it is already everywhere. Any mass curves spacetime around it, so the Earth, the Sun and the International Space Station all pull. What astronauts lose in orbit is weight, not gravity: at the ISS altitude, around 400 km, Earth's pull is still roughly 90 % of its surface value, but everything is falling together.

Gravity does not switch on or off
The common phrase «zero gravity» is misleading. Gravity is a property of mass itself: in Newton's description, every mass attracts every other mass with a force that falls off as the square of the distance; in Einstein's, mass and energy curve spacetime and objects simply follow the straightest available path through that curvature. Neither description has a boundary beyond which gravity stops. It weakens with distance, but it never disappears, which is why the Moon stays bound to the Earth and the Earth to the Sun across enormous gaps.
At the altitude of the International Space Station, about 400 km above the surface, the Earth's gravitational pull is still close to 90 % of what it is at sea level. An astronaut there weighs almost what they would weigh on the ground, if you could put them on a scale that was not itself falling.
Why things float, then
What orbit removes is not gravity but the floor. A spacecraft in orbit is in continuous free fall: it moves sideways fast enough that, as it falls towards the Earth, the surface curves away beneath it at the same rate. The station, the astronaut and the loose pencil all accelerate identically, so nothing presses against anything else. The correct term is microgravity or free fall, and the same state is briefly reproduced on parabolic aircraft flights and in drop towers.
Making weight where there is none
Because gravity cannot be manufactured, engineers substitute acceleration for it. Spinning a structure pushes occupants against the outer wall, and the resulting centrifugal effect is indistinguishable from weight for anyone inside. Constant thrust would do the same. Neither has yet been used for crew on an operational spacecraft, so the practical countermeasures aboard the ISS remain resistive exercise and treadmill running with harnesses to limit bone and muscle loss.
More questions

Lviatour (CC BY SA), vía commons Astronauts and life in space
What did Neil Armstrong see in the Cueva de los Tayos?
An enormous cave full of life, not an extraterrestrial structure. According to an account by a caver on the team, published in 1979, Armstrong was the guest… more…
.jpg)
Astronauts and life in space
Why do astronauts grow taller in space?
In microgravity, the spine is no longer compressed by body weight: it lengthens and the back's natural curves flatten out. The crew gains a few centimeters… more…

Astronauts and life in space
How do astronauts sleep in space?
Each astronaut on the International Space Station has an individual cabin about the size of a phone booth, with a sleeping bag strapped to the floor, ceiling… more…

Astronauts and life in space
How long do astronauts sleep?
The International Space Station's schedule reserves 8.5 hours of sleep per night for each crew member. In practice, they sleep less: a study published in 2014… more…

Astronauts and life in space
How do astronauts eat in space?
Meals on board are mostly dehydrated foods rehydrated with water from a dispenser, and ready-to-eat thermostabilized dishes warmed in the galley oven, along… more…

Astronauts and life in space
How much money does Alexander Gerst have?
There is no reliable figure for Alexander Gerst's fortune; the amounts on celebrity websites are estimates without basis. What is documented is his… more…