The structure of real and virtual photons has been studied in electron-proton scattering processes producing di-jet events at HERA by the H1 and ZEUS collaborations. Data have been compared to next-to-leading order QCD calculations and to the predictions of Monte Carlo generators based on the DGLAP and CCFM formalisms for describing the parton dynamics