Abstract Three-dimensional photonic crystals made of close-packed polymethylmethacrylate (PMMA) spheres or air spheres in silica, titania and ceria matrices have been fabricated and characterized using SEM, XRD, Raman spectroscopy and UV–Vis transmittance measurements. The PMMA colloidal crystals (opals) were grown by self-assembly from aqueous suspensions of monodisperse PMMA spheres with diameters between 280 and 415 nm. SEM confirmed the PMMA spheres crystallized uniformly in a face-centred cubic (fcc) array, and UV–Vis measurements show that the colloidal crystals possess pseudo photonic band gaps in the visible and near-IR regions. Inverse opals were prepared by depositing silica (SiO 2), titania (TiO 2) or ceria (CeO 2) in the voids of the PMMA colloidal crystals using sol-gel procedures, then calcining the resulting structure at 550 °C to remove the polymer template. The resulting macroporous materials showed fcc ordering of air spheres separated by thin frameworks of amorphous silica, nanocrystalline titania or nanocrystalline ceria particles, respectively. Optical measurements confirmed the photonic nature of the inverse opal arrays. UV–Vis data collected for the opals and inverse opals obeyed a modified Bragg’s law expression that considers both diffraction and refraction of light by the photonic crystal architectures. The versatility of the colloidal crystal template approach for the fabrication of macroporous oxide structures is demonstrated.