A new sol-gel route for the preparation of nanometer-scale ZnS semiconductor particles that display quantum optical behavior is reported. Exploiting the scaling relationship between size and density of fractal polymeric precursors, films are prepared with narrow pore size distributions that serve as templates to constrain the growth of ZnS semiconductor particles. Blue shifts of the ZnS absorption threshold indicate that the particle size is reduced from 4.6 to 2.3 nm as the pore size is reduced from 3.5 to less-than-or-equal-to 2.0 nm. Results obtained using transmission electron microscopy are in general agreement with the spectroscopic results. This is a general approach for preparing thin-film nanocomposite materials with tailored optical and/or electronic properties.