A new approach to designing computer-generated multilevel diffractive elements, in which the phase and the amplitude of the output wavefront can be controlled independently, is presented. In this approach the diffraction efficiency of the elements can be arbitrarily controlled to reach 100 percent efficiency over the entire element. The approach is based on varying the local diffraction efficiency by changing the width and the number of levels in every period. To reduce complexity, an algorithm for designing the element with the least number of levels and masks is developed. This design algorithm determines the needed mask parameters in which compensation for distortions introduced by the lithographic recording of the element are taken into account. Calculated and experimental investigations that confirm the new design approach are presented.