Periods are horizontal rows, and groups are vertical columns. Elements in the same period have the same number of electron shells, while elements in the same group have the same number of valence electrons.