Depth of field (DOF) refers to what is and isn't sharp in a picture. Images with great depth of field have a large zone of sharpness, so that everything from just a few feet in front of the camera to infinity will be sharp. Depth of field at a given focusing distance extends 1/3 in front of the point of focus and 2/3 behind it. The three key factors to depth of field are aperture, lens type or focal length and subject distance:
By closing the aperture, you are not only limiting the amount of light that reaches the CCD but you also create a greater area of sharp focus. The smaller the aperture you choose (say 16 or 22) the larger the depth of field.
At any given aperture, a wide-angle lens or the wide-angle setting of a zoom lens yields far more depth of field than telephotos or tele settings. A 28-mm lens set to f8 gives a larger area of sharpness than a 300-mm lens at the same aperture.
The closer your subject is to the camera the less depth of field you get for any given lens type or aperture. This is the reason there is so little depth of field in macro photography where the subject is often only inches away from your camera.