The cave-dwelling of Shanxi and Shaanxi is unique in conception, and various shapes exist, depending on the natural environment, geographical features and local customs. They can, however, be divided into three categories as far as the configuration and structure are concerned, namely: the kaoya (against a precipice), the xiachen (sunk) and the duli (independent) types. Kaoya-type cave-houses are further divided into kaoshan (against a mountain) and yan'gou(facing a gully). Caves are often arranged in curved or zig- zag lines, lending them harmonious beauty and architectural artistry. Where the height of the slope permits, cave-dwellings are often arranged in layers like storied houses. Xiachen type cave-dwellings are constructed underground, and mainly distributed in loess areas without slopes or gullies. Construction of such dwellings is as follows: a square pit is first dug out to form a siheyuan, the cave-dwellings then being dug out in the direction of the four walls. Such dwellings are only to be found in China and Tunisia. While in Tunisia, existing cave-dwellings of this type are rare, they are still widely used by a good number of people in China, a fact that is unique in the world. The duli cave-dwelling is a kind of archtype house covered with earth. There are cave-dwelling both of fired and unfired bricks, earth, and with brick or stone arches. As stated above, such dwellings need not lie against a precipice and can stand independently, but still possess the merits of a cave-house.
Cave-dwellings represented an ideal form of building for the sweeping loess highlands in which they are situated. Warm in winter, cool in summer, taking up very little land and easy to build, they are ideally insulated against fire, wind and noise, even offering protection in the event of an earthquake. A gully can be filled with layers of such dwellings, which almost dissolve into the natural environment.