When is a corner kick takin?

A corner kick is awarded any time the ball crosses the goal line after being last touched by a defending player.