House Speaker Nancy Pelosi, D-CA, speaks during an event to call for the protection of affordable healthcare for those with preexisting conditions during a press conference in front of the US Supreme Court in Washington, DC on April 2, 2019.

The Democratic-held House voted Wednesday to condemn the Trump administration's support for a lawsuit that aims to toss out the Affordable Care Act.

The resolution will have little practical effect and likely will not get a vote in the GOP-held Senate. But by approving the measure, Democrats aim to put pressure on House Republicans ahead of a 2020 election that the party again wants to frame as a referendum on GOP attempts to scrap the health-care law.

It passed the House by a 240-186-1 vote, as one Republican member voted "present." Eight GOP lawmakers — many of whom could face tough reelection bids next year — supported the measure. Only one Democrat — Rep. Collin Peterson, an Obamacare skeptic whose Minnesota district overwhelmingly backed President Donald Trump in 2016 — voted against the resolution.

Trump reignited sparring over the ACA, known as Obamacare, last week when his Justice Department backed a federal judge's ruling that the entire law is unconstitutional. After Republicans in Congress showed no appetite for reopening the politically perilous fight over reforming the health-care system, Trump said he would wait until after next year's election to push to replace the law.

Still, Democrats have tried to use the lawsuit against Trump, as it would toss out Obamacare and its popular protections for people with pre-existing medical conditions. The party will likely target House Republicans who voted against the resolution, which freshman Rep. Colin Allred, D-Texas, introduced.

Allred was one of the Democrats who won a GOP-held seat in last year's midterms while running on health care as his primary issue. His party flipped 40 net Republican seats in November, in no small part because of GOP attempts to repeal the health-care law. It became more popular in 2017 as voters saw the various GOP proposals to replace it.

The Democratic resolution says the Justice Department's actions "are an unacceptable assault on the health care of the American people." It calls on the Trump administration to reverse its position and "protect individuals with pre-existing conditions, seniors struggling with high prescription drug costs and the millions of people in the United States who newly gained health insurance coverage since 2014." Obamacare's Medicaid expansion went into effect that year.

The House members who broke with their parties on the vote are listed below. All of the lawmakers are either considered among the more centrist members of their party or could face a difficult reelection bid next year.

Rep. Brian Fitzpatrick, R-Pa.

Rep. John Katko, R-N.Y.

Rep. Collin Peterson, D-Minn.

Rep. Tom Reed, R-N.Y.

Rep. Denver Riggleman, R-Va.

Rep. Chris Smith, R-N.J.

Rep. Pete Stauber, R-Minn.

Rep. Elise Stefanik, R-N.Y.

Rep. Fred Upton, R-Mich.

Resistance to Obamacare repeal unites a Democratic caucus that has not coalesced around the best way to expand health-care coverage. Republicans have hammered Democrats over some members' support for a "Medicare for All" plan that would guarantee health insurance for every American and, depending on which version of the proposal, could eliminate private insurance entirely.

In criticizing Obamacare on Monday, Trump tweeted that "even the Dems want to replace it, but with Medicare for all, which would cause 180 million Americans to lose their beloved private health insurance."

Trump tweet: Everybody agrees that ObamaCare doesn't work. Premiums & deductibles are far too high - Really bad HealthCare! Even the Dems want to replace it, but with Medicare for all, which would cause 180 million Americans to lose their beloved private health insurance. The Republicans.....

The president claimed Wednesday that he "was never planning a vote prior to the 2020 election" on health care. In a tweet, he also claimed Republicans are "now developing" a "much better & less expensive" Obamacare alternative that "will be on full display" during the election. It is not clear that the GOP is developing any plan or whether it will actually lower prices or expand coverage.

Trump tweet: I was never planning a vote prior to the 2020 Election on the wonderful HealthCare package that some very talented people are now developing for me & the Republican Party. It will be on full display during the Election as a much better & less expensive alternative to ObamaCare...

On Tuesday, Senate Majority Leader Mitch McConnell said he told Trump the Senate would not revisit health-care reform before the 2020 election. He recently told Politico that he is "focusing on stopping the 'Democrats' Medicare for none' scheme."

Subscribe to CNBC on YouTube.