I had the same dress code in school too. Boys hair was not allowed to go over the ears, sideburns could not go below the earlobe, front hair could not touch eyebrows, and hair in the back could not touch the collar of your shirt. We also had to be clean shaven and any sort of facial hair earned you a trip to the bathroom with a one blade bic. I remember our principal telling us "we prohibit facial hair because only drug dealers have facial hair and there won't be any goddamn drug dealing in my school". Of course I ended up being a drug dealer, albeit a legal one lol
My high school English teacher was a total bitch about hats for visitors. If you walked inside the school with a hat on she would yell at you to take it off. It was the same diatribe "Hey! Take your hat off! You're inside a school with women and children! Show some respect!" I still don't understand what she meant by that (can't ask her now because she's dead).