This is a schematic showing how atmospheres form.
Click on image for full size
Image from: The New Solar System
How a planet-to-be sweeps up nearby material to be part of itself
As shown in this picture, while they were forming in the solar nebula, the core of the planets-to-be drew material to themselves from the cloud of gas and dust around them. The bigger planets-to-be were able to draw even more material unto themselves because of gravity.
Big protoplanets such as Uranus and Neptune were positioned far out in the cloud where there was less gas. That is why Uranus and Neptune are not as big as Jupiter.
You might also be interested in:

The position of the planets in the solar nebula affected how big they became and what they were made of. The blue line in the picture shows where it became so cold that ice began to form. Planets that
...more
Besides methane, Uranus' atmosphere contains even more complex molecules. These molecules form layers of smog over the clouds of Uranus, as shown in the picture.
...more
The mesosphere of Uranus is a region of balance between warming and cooling. That essentially means that nothing happens there. Except for diffusion, the atmosphere is still. Upper reaches of the atmosphere,
...more
As on Earth, the atmosphere of Uranus consists of a troposphere, stratosphere, mesosphere, and thermosphere. The troposphere is the region where the visible clouds are to be found. The stratosphere, as
...more
On Uranus, as on Jupiter, the winds in the belts and zones blow first in one direction, then in the other direction. The clouds rise up in a belt, and drop down in a zone, as shown in this picture. This
...more
The clouds on Uranus, like Jupiter, are divided into stripes. On Uranus the stripes are hard to find. The left picture shows the north pole of Uranus. In this picture only the smog can be seen. The clouds,
...more
The clouds of Uranus, made of methane crystals, are found very low in the sky, and are difficult to find beneath the hazey smog of the pla net. False color is used, in the picture of Uranus to the right,
...more