Add category class to body on single posts in WordPress

Drop this code on your functions.php

<?php
//Add category class to body on single posts
add_filter('body_class','add_category_to_single');
function add_category_to_single($classes, $class) {
	if (is_single() ) {
		global $post;
		foreach((get_the_category($post->ID)) as $category) {
			// add category slug to the $classes array
			$classes[] = 'single-cat-'.$category->category_nicename;
		}
	}
	// return the $classes array
	return $classes;
} 
?>

Source