As the critical techniques of lithographic system, the nano-positioning techniques, including the wafer-mask alignment, gapping between wafer and mask and wafer focusing, are of great significance to the improvement of resolution of the projection lithography and the proximity nanolithography, such as X-ray lithography, nanoimprint, and zone-plate-array lithography etc. This paper presents a scheme based on grating modulation and spatial phase imaging. The relative move and gap variation between mask and wafer can be associated with the shift or phase variation of fringe pattern and obtained simultaneously. Two gratings with slightly different periods are adopted as alignment marks and gapping marks on wafer and mask. Fringes with period that is inversely proportional to the difference of periods of two gratings occur in the superposition of two grating marks. First, the theoretical background is introduced and the mechanism of alignment gapping is detailed. Next, the scheme and framework of alignment and gapping method is constructed. Finally, numeric computational and experimental results indicate that the displacement detectivity at nanometer or even sub-nanometer level can be realized in this scheme