With a particular focus on social media, Melania Trump, the first lady, has long said she wants to curb online bullying and harassment as part of a nascent effort to improve the lives of American children. There’s one problem: Mrs. Trump’s efforts often clash with the president’s longtime habit of using social media to insult people.

Despite the criticism, she has continued to develop an agenda around cybersafety. On Tuesday, Mrs. Trump invited representatives from Facebook, Snap, Google, Amazon and Twitter to the White House for a round-table discussion on the topic. In a speech, she said that she had received letters from children who have been bullied or feel threatened on social media.

“I am well aware that people are skeptical of me discussing this topic,” Mrs. Trump said on Tuesday. “I have been criticized for my commitment to tackling this issue, and I know that will continue. But it will not stop me from doing what I know is right. I am here with one goal: helping children and our next generation.”

So far, Mrs. Trump is working on this initiative independently of her husband. On Tuesday, President Trump had already attacked Democrats. Here are other times his behavior on Twitter has clashed with her public remarks on the importance of curbing bullying.