The self-assembly of monodispersed colloids into an ordered three-dimensional structure, i.e., the opal structure, is routinely employed to fabricate the photonic crystal. Moreover, with the aim of obtaining complete photonic band gap, inverse opal structure with better optical properties can also be formed by infiltrating nanochannels with materials of appropriate refractive index. This paper describes the preparation and characterization of opals and their consequent infiltration for forming inverse opals. First, monodisperse P(St-co-MAA) microspheres are prepared and used as building units for opal structures. The random particles self-assembled into a well-ordered structure in three dimensions for 24 h due to an enhanced-capillary-induced gathering force among the particles in system with controlled humidity. The inverse opal can then be formed by electrophoresis of silica nanoparticles 12nm in diameter into the nanochannels, followed by subsequent calcination in air. Finally, well-formed three-dimensional porous structures consisting of interconnected close packed arrays of spherical voids are obtained. Therefore, we succeed to fabricate both the opal and inverse opal structures by the proposed capillary-enhanced method and the electrophoresis method, respectively. (C) 2004 Elsevier B. V. All rights reserved.