We have constructed an optical non-contact displacement detector for in-situ measurements, and several Co/Pd multilayer thin films prepared by dc magnetron sputtering technique have been examined to investigate the effect of stress on the magnetic anisotropy of the films. The detector was located behind the free end of a substrate and the other side of the substrate was fixed by a substrate holder. A change of the gap-distance between the detector and the substrate, caused by the stress of a deposited film, was detected by a corresponding change of reflectivity. The stress of a film was turned out to be tensile at the very beginning of the deposition, which might be ascribed to the surface tension between islands. It was observed that the stress of a Co layer on Pd layer was tensile, while a Pd layer on Co layer was compressive. The results are as expected since the lattice constant of Pd is larger than Co at the (111) matching plane. It was found that the stress-induced anisotropy was an important contribution to the magnetic anisotropy of the Co/Pd multilayer thin films. An observed kink at the Co thickness of about 5$\mbox{\AA}$ in a Kt vs. t plot, where K is the effective magnetic anisotropy and t is Co thickness, was believed due to a structure change from coherent matching to incoherent matching at the interface.