The offside rule is designed to prevent goal-hanging. A player is in an offside position if they are nearer to the opponent's goal line than both the ball and the second-to-last defender when the ball is played to them. However, it's essential to note that being in an offside position is not an offense by itself; the player must become actively involved in the play to be penalized.