There were many different species of ammonite living in all oceans, and each species was quite short-lived, so now palaeontologists use ammonites as 'index' fossils, helping to define the age of a fossil bed. As ammonites grew, they walled off older sections of the shell, filling them with gas (see below), and lived in the outermost compartment only. This will have allowed the animal to alter its buoyancy (how deep it floated).
Ammonites became extinct at the same time as dinosaurs, about 65 million years ago - up to two-thirds of all species became extinct at this time, not just the dinosaurs.
The inside of an ammonite shell. The spaces are known as chambers and the walls between as septae.
The Nautilus (below) is a very similar creature that lives today. The inside of the shell is similar to thatof ammonites. Ammonites were also related to cuttlefish and squid.