The confinement of Ar in planar slits of two identical parallel semi-infinite walls of alkali metals, alkaline-earth metal Mg, and CO 2 is investigated within the framework of the density functional theory. It is assumed that ͑1͒ the fluid atoms interact via a recently proposed effective attractive pair potential with strength, f f , which reproduces the experimental data of the surface tension of the liquid-vapor interface at the bulk coexistence curve, and ͑2͒ the adsorption on the walls is described by ab initio potentials characterized by a well depth, W sf . In this way the systems were studied in the framework of a realistic approach. We found that for small coverages, the slit is always filled by forming two symmetric vapor films, one at each wall. For increasing coverage the behavior depends on the ratio W sf / f f and the temperature T. In the case of alkali metals, we found at the triple point, T t , of the adsorbate a regime of average density av ء in which the ground state exhibits asymmetric density profiles, leading to the so-called spontaneous symmetry breaking ͑SSB͒ effect. The SSB appears at an average density sb1 ء and disappears at a higher average density sb2ء . When T is increased, the range of densities sb1 ء Յ av ء Յ sb2 ء diminishes and eventually the SSB disappears at a critical temperature, T sb , which coincides with the critical prewetting temperature T cpw observed in the adsorption on a single wall. For T Ͼ T cpw the slit is filled symmetrically up to the phase transition to capillary condensation. All these features are examined as a function of the strength of the substrate and the width of the slit. Furthermore, no SSB effect was found for Mg and CO 2 .