I was a teenager the last time leggings were in.
I figure - under a top that is long enough to cover your but, fine, with a shorter top, not. And I'd say that for girls or boys.
I think it's much easier for the school to just say no leggings, or only covered leggings, than it is to say "Leggings as pants are fine, but only if they are of a fabric thick enough to cover visible panty-lines, are tastefully worn, and suit your body type (ie, yes for long skinny girls, no for curvy ones). Looking at the links below, I'd say that while some of these would be fantastic out at a nightclub, none of them are appropriate for either school or most jobs.
I do think it's reasonable for schools to set some boundaries on what kids are allowed to wear - no leggings, no visible underwear (girls or boys), no lounging pyjamas, skirts and shorts of a certain length, and so on. Some schools do go overboard, to the point that uniforms would be an improvement.
Part of the bias in girls vs boys dress codes is that girls' clothing is generally designed to be much sexier than boys clothing. If boys came in wearing skin tight leggings that outlined their package, or shorts so short that they risked falling out, or navel baring tops with plunging necklines, the schools would ban those too. These fashions exist, but they're not strongly marketed towards adolescent boys.
As an aside - shorts are interesting. I end up wearing men's shorts a lot, for the simple reason that I can't buy shorts larger than a US size 10 where I live. When I go back to North America, and can buy women's shorts in my size, I find that they are on average about six to eight inches shorter than the men's shorts in a similar style. It can be quite difficult to find women's shorts of a length I'm comfortable wearing in public.