Why were schools so against wearing hats? what's wrong with a hat?

what's the point of policing this arbitrary item?