We show how, given observed equivalent widths of Mg ii and Mg i absorptions due to an interstellar cloud in which a late-B star is embedded, the basic physical parameters: kinetic temperature, mean density, electron density, and radius can be constrained. Hydrogen ionization by means of cosmic rays and the effect of the stellar radiation field on the magnesium ionization equilibrium are taken into account. The method is applied to the reflection nebula surrounding the star HD 26676. The resulting solutions for the radius and temperature of the nebulosity are comparable to the typical values derived for diffuse interstellar clouds from optical and 21-cm measurements, if a cosmic-ray ionization rate ζ≤10-16s-1 — in agreement with recent determinations — is assumed. The results are not strongly dependent on the gas pressureP forP varying in a range of values typical of interstellar clouds.