We had a dress code when I was in school. For girls, skirts needed to be at least knee length. For males, no shorts were to be worn etc.
And common sense, and morality, and responsible parents, and good teachers, and no racism.
When I went, no jeans of any kind, girls skirts at knne lenght or below, no “tight” sweaters for girls (that pretty much sucked”, no sneekers except in gym class, no more then one button undone on shirt or blouse amd after a warning boys would be sent home if their hair was to long. DA’s were allowed but the hair had to be properly combed.
Now you have an idea of my age. This was a public school.