Beat budget
The time signature sets the measure's beat budget: the top number is beats per measure, the bottom number is which note value counts as one beat. In 4/4 the bottom 4 means a quarter note is one beat, so a measure holds four quarters, or one whole note, or two halves, or eight eighths. Notes and rests come in these same durations, and each measure must total exactly the budget.