Law 9 – The Ball in and Out of Play
Ball Out of Play
  The ball is out of play when:
  • it has wholly crossed the goal line or touch line, whether on the ground or in the air

  • play has been stopped by the referee.

Ball In Play
  The ball is in play at all other times, including when:
  • it rebounds from a goalpost, crossbar or corner flagpost and remains in the field of play;

  • it rebounds from either the referee or an assistant referee when they are on the field of play.

more on The Ball in and Out of Play