The electronic and magnetic structure of ferromagnetic Ni films grown epitaxially on ultrathin films of Co has been studied by x-ray-absorption spectroscopy (XAS) using circular polarization. The growth morphology of the films was verified using high-resolution low-energy electron diffraction and indicated an incomplete layer-by-layer growth mode for the Co and Ni films deposited on Cu(001). We report the presence of additional peaks in the x-ray magnetic circular dichroism (XMCD) as predicted by the configuration interaction model. The ground-state magnetic moments were obtained from the XMCD sum rules at the Ni $2p$ edge. For a film thickness below 2 ML the number of holes and the spin polarization (spin moment per hole) show a gradual decrease, while the orbital polarization (orbital moment per hole) and the spin-orbit interaction show a gradual increase in magnitude. The 6-eV satellite structure, which is present in the XAS and XMCD of bulk Ni, disappears for submonolayer coverages while the dichroism due to ``diffuse magnetism'' between the ${L}_{3}$ and ${L}_{2}$ edges is strongly enhanced. These observations are ascribed to changes in the hybridization (electronic mixing) as a function of film thickness, which influences the ground-state ${d}^{8}$ weight and the s-state spin polarization. The strongly increased orbital moment per spin provides a good measure for the degree of localization. It is shown that for Ni thin films a localization of the wave function does not lead to an enhancement in the total magnetic moment, but, on the contrary, its value is twice as small as the bulk value.