Gravitational forces are only attractive but electromagnetic forces are both attractive and repulsive. Because magnetic force has negative and positive charges, it can be both attractive and repulsive. Gravity affects objects at a distance, but the attraction weakens as the objects get farther apart.