We study the stationary and propagating solutions for a Bose-Einstein condensate (BEC) in a periodic optical potential with an additional confining optical or magnetic potential. Using an effective mass approximation we express the condensate wave function in terms of slowly-varying envelopes modulating the Bloch modes of the optical lattice. In the limit of a weak nonlinearity, we derive a nonlinear Schrdinger equation for propagation of the envelope function which does not contain the rapid oscillation of the lattice. We then consider the ground state solutions in detail in the regime of weak, moderate and strong nonlinear interactions. We describe the form of solution which is appropriate in each regime, and place careful limits on the validity of each type of solution. Finally we extend the study to the propagating dynamics of a spinor atomic BEC in an optical lattice and some interesting phenomena are revealed.