It is a mistake to assume that the cores of the gas and ice giants are solid, just because they are thought to be "rocky". Temperatures deep inside these planets are very high - I remember reading a figure of 25,000 Kelvins for Jupiter. Pressures are very high too, and the way materials behave under these conditions is not well understood. So there could be a solid core in there, but there is also evidence that there may be no proper core at all, just a circulating molten mixture of hydrogen, helium, and so forth, with more and more elements like silicon and iron as you get closer to the middle.
With the outer planets, when you read about a "rocky" core, you should just think "a core with lots of the elements that rocks are made of on Earth," not a solid surface that some super-strong machine could roll around on.
In fact, the terms "gas giant" and "ice giant" can both be a little misleading. Once you get just a small fraction of the way into the atmosphere, the pressures are so great that the hydrogen is no longer really a gas but a supercritical fluid, which is dense like a liquid but completely fills any container, like a gas. So calling it a "gaseous planet" isn't really right.
And Uranus and Neptune have come to be called "ice giants" because they are mostly methane and ammonia, which are solid at the temperatures you find that far from the sun. But they are not solid in Uranus and Neptune. They are gaseous and then supercritical as you get further in. Actually I think there are clouds of ammonia crystals, so ammonia ices are present. But they don't make up the bulk of the planet.