District lawmakers quietly voted Tuesday to ban the use of plastic-foam food and drink containers, still common in city cafes and carryouts, by 2016. The vote puts the District in the company of Seattle and San Francisco, among other cities that have banned foam containers for environmental reasons.

The ban was included in a broader environmental bill introduced by Mayor Vincent C. Gray (D) in the fall. That bill passed an initial vote Tuesday without debate.

Under the version of the Sustainable D.C. Omnibus Act of 2014 passed Tuesday, the ban would take effect Jan. 1, 2016 — two years sooner than Gray had sought. Further, food and beverage outlets would be required to offer only compostable or recyclable containers by 2018.

The bill passed over objections from the plastics industry, which has called the foam ban “an expensive new burden” on businesses and consumers. But the ban was championed by environmental activists, particularly those working in city waterways, who have said foam containers dissolve into tiny particles that can harm fish and animals.

Polystyrene foam, of which Styrofoam is one brand, is not fully biodegradable.

Council member Mary M. Cheh (D-Ward 3), who chairs the committee that handled the bill, held up her paper Starbucks cup behind the council dais and said consumers shouldn’t have to sacrifice much. “This is a great cup,” she said. “They won’t notice the difference, and they can feel better about themselves and the environment.”

The foam ban comes four years after the city imposed a 5-cent fee on plastic bags, a move that has generated about $2 million a year for river cleanup programs and is credited by environmental activists with keeping many stray bags out of the water.

Other parts of the bill provide for more transparency in utility billing, require employers of 20 workers or more to offer a transit benefit program, ease beekeeping regulations and tighten restrictions on tree removal.

A second and final vote on the bill could come as soon as July 14.