Antibiotics work in one of a few ways: by either interfering with the bacteria's ability to repair its damaged DNA, by stopping the bacteria's ability to make what it needs to grow new cells, or by weakening the bacteria's cell wall until it bursts.
Most antibiotics on the market are considered broad spectrum, which means they are effective against a lot of different types of bacteria, both Gram-positive and Gram-negative. Fluoroquinolones (used to treat infections ranging from urinary tract infections to pneumonia and anthrax) and tetracyclines (used to treat everything from acne to gonorrhea as well as stomach ulcers) are both examples of broad spectrum antibiotics -- these antibiotics can clear up many types of bacterial infections. Narrow spectrum antibiotics, on the other hand, are effective against specific, targeted groups of bacteria -- either Gram-negative or Gram-positive but not both.
Quinolones, for instance, are a type of broad-spectrum antibiotic that kills bacteria with hydroxyl radicals, which are molecules that destroy the lipids and proteins that make up a cell's membrane and damage cell DNA, halting replication.
Penicillins, an example of narrow-spectrum antibiotics, work by destroying the structure of a cell wall, the layer that holds the whole cell together; glycopeptide antibiotics also go to work on the structure of a cell wall, specifically preventing Gram-positive bacteria from being able to build new walls -- and a cell can't live without the wall that holds all of its innards, well, inside.
Instead of destroying a cell from the outside in, like penicillin, some antibiotics block a cell's ability to make what it needs to proliferate from the inside out. Macrolide antibiotics are protein synthesis inhibitors; for example, the common macrolide antibiotic erythromycin works by binding to specific molecules -- subunits -- in a cell's ribosome, destroying the cell's ability to form the proteins it needs for cell growth. Sulfa antibiotics (sulfonamides) have been used to battle bacterial infections since the 1930s. They target specific chemical reactions within a cell -- the metabolic pathways -- by binding to an enzyme called dihydropteroate synthase (DHPS), which then blocks bacteria's ability to synthesize dihydriofolic acid. When this type of bacterial cell stops being able to metabolize folate, it can no longer grow or multiply.