The sine function gives you the opposite over the hypotenuse. The hypotenuse is the length of the ramp.
So, sin(30) = 12 / L.
But we need to isolate L.
So start by multiplying both sides by L.
This yields L * sin(30) = 12.
Then, divide both sides by sin(30).
This yields L = 12 / sin(30).
Sin(30) = 1/2 or 0.5, so 12 / 0.5 = 24 inches.