Ionic compounds are the combination of cations and anions. In table salt, sodium chloride, sodium is the cation (Na+) and chloride is the anion (Cl-). In the crystal structure, the anion (Cl-) and the cation (Na+) form a regular pattern alternating back and forth. In the 2 dimensional picture below we can see that each sodium ( Na+ ) is surrounded by chlorides(Cl-). The crystal is held together by electrostatic attraction.
This pattern holds true for three dimensions as well. Because of this, each sodium ion, is surrounded by six chlorine ions, and each chlorine ion is surrounded by six sodium ions.
A crystal builds up like this, giving the sodium chloride crystal a cubic structure. The crystal is composed of this structural unit repeated in three dimensions. This cubic structure is reflected in the cubic shape of salt crystals. This is why the salt crystals form angles of 90°.
You can clearly see the cubic structure of these ordinary table salt crystals because they have been magnified about ten times.
Not all crystal structures have a cubic repeating unit. Some are hexagonal such as gold, quartz (SiO2) or water. The shapes of the unit cells will affect the shapes of the crystals. Many of you may have quartz crystals at home. Look at your crystals. The crystal probably shows angles of 120°. This is a reflection of the 120° angles in the crystal.