The electronic structure of BaFe$_2X_3$ ($X$ = S and Se) and CsFe$_2$Se$_3$ in which two-leg ladders are formed by the Fe sites are studied by means of x-ray absorption and resonant inelastic x-ray scattering spectroscopy. The x-ray absorption spectra at the Fe L edges for BaFe$_2X_3$ exhibit two components, indicating that itinerant and localized Fe 3$d$ sites coexist. Substantial x-ray linear dichroism (XLD) is observed in polarization dependent spectra, indicating the existence of orbital order or fluctuation in the Fe-ladder even above the N{e}el temperature $T_N$. Direct exchange interaction along the legs of the Fe-ladder stabilizes the orbital and antiferromagnetic orders in BaFe$_2$S$_3$, while the ferromagnetic molecular orbitals are realized between the rungs in CsFe$_2$Se$_3$.