I concur with the above answer, and would also like to add a couple of other factors that influenced Imperialism in Africa during this time period.
Strategic Advantage - First, consider the strategic significance of African colonies such as South Africa and Egypt, which gave Britain control of vital waterways for trade routes in the Cape of Good Hope and later, in the Suez Canal and the Mediterranean Sea. This allowed the British Empire to maintain its dominance of the high seas, especially during the time period you mention. These trade routes, it should be said, made imperialism in Asia and the Middle East more feasible too.
Cultural Imperialism - Underlying the desire of these countries to spread their empires was the racist and arrogant belief that their empires, cultures, languages and religions were also superior to the tribes and peoples of Africa, and that taking their natural resources could be justified by "civilizing" such peoples.
The causes of European imperialism in Africa were much like the causes of European imperialism elsewhere. European countries took colonies in Africa and elsewhere for two major reasons.
The first of these was economic power. There were many kinds of natural resources to be had in various parts of Africa. The European nations wanted to have a monopoly on those resources and therefore wanted to colonize the areas in which the resources were found.
The second reason was national prestige. European countries felt that any major power ought to have an empire. They felt that letting other countries get larger empires than their own would undermine their own prestige and, therefore, the amount of power they had in the world.
For these reasons, European countries tried to get empires in Africa.