It's a little more difficult on a road bike than on a mountain bike. But the difference isn't drastic. If you learn on a mountain bike you can easily transfer the skill to a road bike. But if all you have is a road bike, find a good spot where you don't have to worry about cars or pedestrians. There should be a mild rise to the pavement -- even just a slight hump is plenty.
Now ride slowly up to the hump but just slightly to the side. It's usually easiest if you stand, feather the rear brake to a stop and keep a little tension on the brake lever. The key is to keep your center of gravity directly over the center of the bike so that gravity is pulling straight down. Of course if you've ever tried this, you know that the bike will begin to lean one way or the other. This is where the slight tilt in the pavement comes in. For this example, assume that the rise is slightly to the left of the front wheel. Turn the wheel at a substantial angle into the rise. This way you can compensate for the lean of the bike by riding the bike an inch or two, back under your center point. If the bike begins to lean to the left, a little pressure on the pedal, (one pedal should be at about the 1 O'clock position), will cause the front wheel to move to the left, under your weight. If the bike begins to lean to the right, you can decrease pressure on the pedal and the slight rise in the pavement will cause the bike to move slightly backward and to the right, again putting the bike directly under your weight. This works because the front wheel is turned sharply enough to move the bike to the right or left by rolling the front wheel an inch or two through pedal force. Keeping a very light tension on the rear brake keeps things from tilting and changing so quickly.
It will take a few tries before you start to get the feel of it and you may want to practice while not locked into the pedals because
you will fall a few times. That's one reason it's best to learn on a mountain bike if possible. You can practice on a softer surface and the wider tires make balancing a little easier.
Anyway, by applying a little pressure to the pedal to shift the bike one direction and reducing that pressure to shift the other direction, it won't be long before you find yourself balancing at intersections so that you don't have to stab for the pedal when the light changes. You'll already be locked in and ready to go. Just remember not to test yourself in traffic before you know you're ready. It's all too easy to get a little cocky and then find yourself sprawled on the pavement from a fall which occurred at a dead stop. It certainly gives motorists something to laugh at.