The continental margins

Why does most mountain building today, take place at continental margins? Was this the same in the past? Why then, do we have mountain ranges such as the Ural Mountains, that are in the centers of continents?