The biggest danger to any building short or tall occurs when the frequency, or timing, of the building's natural vibrations matches the frequency of the quake's vibrations. This condition, called resonance, is similar to what happens when you push someone on a swing. Tall buildings don't usually have this problem. For one thing, they are made of strong, flexible materials that can withstand shaking. For another, they are usually built on solid ground.
Earthquake waves move rapidly through solid ground.
Tall buildings vibrate slowly, so there is less chance that resonance will occur. Even though you might not feel safe in a swaying skyscraper during a quake, chances are you would be. The tall buildings that collapsed during the Mexico City quake of 1985 were an exception. They were built on soft soils, through which quake waves move slowly. They literally fell victim to resonance because their slow vibrating frequency matched that of the ground.