Dress codes have been challenged on the basis of gender discrimination, with courts upholding the rights of employers to set different appearance standards for men and women.