We study optical pumping of resident electron spins under resonant excitation of trions in n-type CdTe/(Cd,Mg)Te quantum wells subject to a transverse magnetic field. In contrast to the comprehensively used time-resolved pump-probe techniques with polarimetric detection, we exploit here a single beam configuration in which the time-integrated intensity of the excitation laser light transmitted through the quantum wells is detected. The transmitted intensity reflects the bleaching of light absorption due to optical pumping of the resident electron spins and can be used to evaluate the Larmor precession frequency of the optically oriented carriers and their spin relaxation time. Application of the magnetic field leads to depolarization of the electron spin ensemble so that the Hanle effect is observed. Excitation with a periodic sequence of laser pulses leads to optical pumping in the rotating frame if the Larmor precession frequency is synchronized with the pulse repetition rate. This is manifested by the appearance of Hanle curves every 3.36 or 44.2 mT for pulse repetition rates of 75.8 or 999 MHz, respectively. From the experimental data we evaluate the g factor of |g|=1.61 and the spin relaxation time of 14 ns for the optically pumped resident electrons, in agreement with previous time-resolved pump-probe studies.