Raccoons are smarter than skunks, and can easily get the top off of the hive. The best bet is to place a heavy rock on the cover of the beehive. You can also use a live trap like you would for skunks. However, fencing will rarely keep out these bee predators. They will climb the fence if they know there's possible food waiting for them on the other side.
One very effective way to discourage skunks and raccoons is to take some pieces of plywood and fill one side with nails or screws that stick out 1/4 to 1/2 inch on the opposite side and are spaced about 1/2 inch apart. The plywood should be at least 18 inches by 12 inches in size. These boards can be placed in front of each hive to make it uncomfortable for any critter that wants to pull up a seat and snack on your bees or equipment. There have been instances where such boards have been pushed aside by a determined animal. To prevent this, it's a good idea to embed a few sticks or tent stakes in the ground on either side of the boards to help anchor them and to prevent their easy removal. Just remember to remove the boards or turn them over when working around the hives, or you run the risk of nails penetrating your shoes.