In the 1950s, really lasting up until the 2000s, US comics were regulated through the Comics Code Authority (CCA). This organization was formed as an alternative to the government regulating comics. Comics would get submitted to the CCA and the comics would only get the CCA's seal of approval if they fit the code. The need for comic censorship arose from public concern over the gore and horror sometimes depicted in comics. In some cities, dissent was so extreme that public comic book burnings took place and crime/horror comic books were banned.
At the time, many comic book authors felt stifled by the censorship. The words "crime," "horror," and "terror," were not allowed in the comic book's title. Creatures such as vampires, werewolves, ghouls, and zombies were outalwed. As a result, EC Comics experienced a cancelling of every single one of its titles in the year following the CCA's institution. The only surviving 'comic' became MAD, which was transferred to magazine format so as to be out of the CCA's jurisdiction.
And in a famous blow to the CCA's reputation, Stan Lee challenged them with a Spider-Man story. On the request of the United States Department of Health, Education, and Welfare, Stan Lee produced a story in which narcotics were displayed in an extremely negative light. However, comics depicting the use of narcotics at all defied the code of the CCA, so the CCA refused to give their seal. This is in contrast to an earlier story, a Deadman story, approved despite the inclusion of narcotics because the story dealt with the wholesale handling of narcotics. In defiance, Lee removed the Code Seal from the storyline and gained public acclaim.
The CCA had to change its code due to backlash to allow the negative portrayal of drugs, though the damage to its reputation was done.
Throughout the '60s and '70s, "underground" comics allowing the 'edgy' material denied to readers began to arise. The code changed many times throughout the 1980s to the 2000s, allowing for more violence and a depiction of sympathetic criminals or corrupt police officers so long as good triumphed over evil in the end. In 2001, Marvel withdrew from the CCA and created its own rating system to indicate appropriate age groups.
The CCA continued to lose public support and comic companies, eventually becoming an obsolete form of censorship.
Sources: TV Tropes, Wikipedia, Awn.com