So we have 52 horses. We know that 12 are white, so:
W : B - 12: x, where x is the unknown amount of horses.
52 - the twelve white horses = 40 other horses.
This means that there are 40 black horses, so the ration of W:B is 12:40. We can simplify this ratio.
The highest common factor of both numbers is 4, so the ratio can be divided by four, giving 3:10.
Therefore the ratio is 3:10.
Hope I helped!