Here's a breakdown of how it works:
* Sodium (Na) is a metal and has one electron in its outermost shell. It readily loses this electron to achieve a stable, filled outer shell.
* Chlorine (Cl) is a nonmetal and has seven electrons in its outermost shell. It readily gains one electron to achieve a stable, filled outer shell.
When sodium and chlorine react, sodium loses its electron, becoming a positively charged ion (Na+). Chlorine gains this electron, becoming a negatively charged ion (Cl-). These oppositely charged ions are then attracted to each other through electrostatic forces, forming an ionic bond.
The strong attraction between the positive and negative ions creates a stable crystal lattice structure, which is what makes salt a solid at room temperature.