ALAMEDA, Calif. — The relaxed new dress code at public schools in the small city of Alameda, across the bay from San Francisco, is intentionally specific: Midriff-baring shirts are acceptable attire, so are tank tops with spaghetti straps and other once-banned items like micro-mini skirts and short shorts.

As students settle into the new school term, gone are restrictions on ripped jeans and hoodies in class. If students want to come to school in pajamas, that’s OK, too.

The new policy amounts to a sweeping reversal of the modern school dress code and makes Alameda the latest school district in the country to adopt a more permissive policy it says is less sexist.

Students who initiated the change say many of the old rules that barred too much skin disproportionately targeted girls, while language calling such attire “distracting” sent the wrong message.

“If someone is wearing a short shirt and you can see her stomach, it’s not her fault that she’s distracting other people,” said Henry Mills, 14, an incoming freshman at Alameda High School who worked with a committee of middle school students and teacher advisers to revise the policy. “There was language that mainly affected girls, and that wasn’t OK.”

Dress codes have long been the territory of contention and rebellion, but the reversal in Alameda shows a generational shift that students and teachers say was partly influenced by broader conversations on gender stemming from the #MeToo movement against sexual misconduct and a national resurgence of student activism.

Approved by the school board on a trial basis over summer break, the new dress code is stirring back-to-school discussions about what role schools should have in socializing children.

There are sharply critical voices of the new dress code.

RELATED: CPS reviewing Bronzeville principal’s barring kids from dressing ‘provocatively’

Math teacher Marie Hsu said she’s all for equity but that the new rules send an unintentional message that it’s fine, even appropriate, to “sex it up.”

“It’s good not to punish girls for being distractions. I fully, fully get that,” said Hsu, who teaches at Lincoln Middle School and is an Alameda resident with two young children. “But I think it’s extraordinarily misled.”

Alameda mother Paula Walker says she may be “old school,” but she didn’t mind the bans against revealing clothing.

“They say kids are starting everything younger, and I’m like, well, that’s because you’re throwing it in their faces,” Walker said.

Dress codes and their severity vary widely nationwide. Twenty-four states have policies that give local school districts the power to adopt their own dress codes or uniform policies, according to the Education Commission of the States, a nonprofit that tracks education policy.

Some have statewide policies, like Arkansas, which passed a 2011 law requiring school districts “to prohibit the wearing of clothing that exposes underwear, buttocks, or the breast of a female.”

A Texas high school was recently criticized for a back-to-school video on dress codes that only featured girls. The video shown at Marcus High School in a Dallas suburb showed girls in short shorts getting reprimanded as the song “Bad Girls” by M.I.A. played in the background. Students slammed it as sexist on social media, prompting the principal to apologize, saying the video “absolutely missed the mark.”

Alameda’s new dress code was modeled after a suggested policy by the Oregon chapter of the National Organization for Women, drafted in 2016 to “update and improve” dress codes, avoid rules that reinforce gender stereotypes and minimize unnecessary discipline or “body shaming.”

Portland, Oregon’s public school district adopted a new policy in 2016, followed by Evanston, Illinois, in 2017, both of which incorporated NOW’s suggestions.

Portland’s relaxed dress code is considered a success, said Carol Campbell, principal at Grant High School.

Campbell said students wear appropriate clothing most of the time and it was “a huge relief” that staff could now focus on teaching, rather than necklines and hemlines.

“It’s changed the culture of how students view each other,” she said. “When we have rules and dress codes that particularly target one group it sounds like we’re blaming that group, which always tended to be women.”

Students in Alameda, Portland and Evanston have freedom to wear mostly anything as long as it includes a bottom, top, shoes, covers private parts and does not contain violent images, hate speech, profanity or pornography.

Vague language in the old Alameda policy caused confusion, which led to arbitrary enforcement, students and teachers said. There was, for example, a “three-finger” rule on the width of tank top straps and a ban on shorts and skirts shorter than “mid-thigh” and a rule against “low-cut tank tops.”

Girls with more developed bodies often were singled out for discipline ranging from lunch detention, picking up trash on campus, a phone call home or having to change into baggy clothing.

Stella Bourgoin said she makes her sixth-grade daughter dress modestly but she supports the policy mainly for convenience.

“If you go to a store, every pair of jeans has a rip in it. It’s easier this way,” Bourgoin said.

Associated Press writer Gillian Flaccus in Portland, Oregon contributed to this report