Eclipses of the sun and moon are caused by the moon crossing between the sun and the earth (solar eclipse) or by the earth crossing between the sun and the moon (lunar eclipse).
The following visual simulates the relative movement of the sun and the moon around the earth, showing both types of
eclipse.