* Ionic compounds are formed by the electrostatic attraction between positively charged ions (cations) and negatively charged ions (anions).
* Cations are formed when a metal atom loses electrons.
* Anions are formed when a nonmetal atom gains electrons.
Therefore, an ionic compound always contains both a metal and a nonmetal.
Example:
* Sodium chloride (NaCl) is an ionic compound.
* Sodium (Na) is a metal, and it forms a positive ion (Na+).
* Chlorine (Cl) is a nonmetal, and it forms a negative ion (Cl-).
In summary:
* Metals form cations.
* Nonmetals form anions.
* Ionic compounds are formed by the combination of cations and anions, which always involves a metal and a nonmetal.