This depends on the size of the building and how far the earthquake is (as well as how big it is, obviously). So, think of throwing a rock into a pond. Very close to the splash, the waves are very close together. Further away from the splash, the waves get further apart, and they decrease in height. So, this means that big buildings far away may shake more intensely than smaller buildings.
Scientists used to believe that the more rigid a building was, the stronger it was. Now we know that the building should move with the event. We have giant shock absorbers as well as giant metal concave dishes that the feet of the building sit in, so when the shaking starts, the building moves with the shaking.
Mexico City had severe damage to buildings between 10-20 stories during the 1980's, and there were ~10,000 people killed, but the earthquake was all the way off of the west coast of Mexico! Remember that Mexico City is in the middle of the country, nowhere near the ocean.
So, smaller buildings did great, as did the skyscrapers, but mostly those buildings that resonated between 10-20 stories were the buildings that collapsed (apartments and hospitals, where many people were at the time).