One of the tallest dog breeds is the great dane which stands over a meter tall. One of the shortest is the pomeranian which stands about 20 cm tall. Based on artificial selection, how were these two breeds developed?
We know that domestic dogs are descended from wolves. Exactly when and how this occurred is still being studied; many experts indicate that dogs were first domesticated about 12,000 years ago, but a few DNA studies indicate a much earlier date for the split between the wolf and the dog, perhaps as long ago as 130,000 years.
Regardless of the exact timing of the divergence between wolves and dogs, one thing is true: both species display quite a bit of genetic diversity, particularly in size and coloration.
In order to breed a dog of a specific size, all one has to do is choose parents with the appropriate variations. For instance, if you want to create a small dog breed, you would just breed the smallest dogs you have, then you would choose their smallest offspring to breed the next generation, and so on until you have reached the desired size.
Selective breeding for attributes such as size often have unintended consequences; here is a link to an interesting article about how selective breeding for size has actually changed the brain structure of some dog breeds.