Lopez received her first leading role in the Selena biopic of the same name in 1997, which earned her widespread acclaim and a Golden Globe nomination. Following subsequent roles in the films Anaconda (1997) and Out of Sight (1998), Lopez ventured into the music industry in 1999 with the release of her debut album On the 6. With the simultaneous release of her second studio album J.Lo and her film The Wedding Planner in 2001, Lopez became the first person to have a number one album and film in the same week. Lopez's 2002 remix album, J to tha L–O! The Remixes, became the first in history to debut atop the U.S. Billboard 200. Between the release of her third and fourth studio albums – This Is Me... Then and Rebirth – Lopez took a break from her music career to focus on acting, starring in the films Maid in Manhattan (2002) and Shall We Dance? (2004). Lopez's Spanish-language album, Como Ama una Mujer (2007), received the highest first-week sales in the United States for a Spanish album. Her commercial success was severely damaged after the release of her sixth studio album, Brave (2007). The set, which showcased a different musical prospective from the singer, failed to attain the success of her previous efforts and removed Lopez from the music scene until 2011, when she became a judge on the singing competition American Idol; this move allowed her to regain media attention and improved her success at charts, with her single "On the Floor", showcased and released during such timespan, becoming a worldwide hit and her best-selling single to date.
Lopez's public image and high-profile relationships have attracted worldwide media attention. Her marriage to actor Ojani Noa from 1997 to 1998 was proceeded by a series of lawsuits resulting from Noa's attempts to sell private details of Lopez and their relationship. Following her marriage to Noa, Lopez dated producer Sean Combs, a relationship that became the inspiration for Lopez's 2000 single "Love Don't Cost a Thing". Combs accompanied Lopez to the 42nd Grammy Awards in 2000, where she wore her infamous Green Versace dress. After a series of incidents and Combs' trial and pursuit by the press Lopez terminated her involvement with Combs later that same year. Lopez became romantically involved with actor Ben Affleck, while still married to her second husband Cris Judd, during shooting of Gigli (2003), a film that is considered one of the worst of all time. Their relationship, dubbed as Bennifer by the public, ended as a result of media overexposure, which had a negative impact on both of their careers. After rekindling her relationship with recording artist Marc Anthony, whom she had previously dated in 1999, the two wed in a private ceremony in 2004. Lopez gave birth to the couple's twins, Maximilian and Emme, in February 2008. They were introduced in the March 11, 2008 issue of People, for which the magazine paid a reported $6 million—the photographs of the twins became the most expensive celebrity picture ever taken at the time.