When it comes down to it, depth of field is synonymous with range of focus. It only seems natural that a photographer would want to produce a picture with a wide range of focus, but this is not always the case. If everything in the image is tack sharp, it tells the viewer to look at every detail and that each is important. Conversely, if only certain subjects in the image are sharp, the viewer is drawn to those areas and the rest of the elements become secondary. In the case of landscapes, images work better when everything is sharp from the foreground to the background. But for portraits, and many other subjects, the image is more successful if just the main subject is sharp and the remaining elements fade into softness. So how does a photographer create specific ranges of focus?
Depth of field is controlled by a combination of the following: the f stop used to make the picture, the focal length of the lens, subject distance from the camera, and subject distance from the background. With regards to f stop, the higher the number of the f stop, the greater the depth of field. In other words, with all other factors being equal, f22 will create much more depth of field than f4. This translates to a more sharply rendered foreground and background. With this in mind, as a guideline, for landscapes use f stops closer to f22 and for portraits, use those close to f4.
With regards to focal length, the wider the angle of the lens, the more inherent depth of field it will produce. If the goal is to create images with lots of depth of field, stick with wider lenses. Conversely, as one progresses from medium to long telephotos, the depth of field becomes more and more narrow. This is why many landscapes are made with wide angle lenses and portraits are made with medium telephotos. Once you get to 300mm and greater, depth of field becomes narrow and careful placement of the focusing sensor over the part of the subject that is most important is critical.
The last two factors that impact the range of sharpness both deal with distance. The closer you get to your subject, the more the background falls out of focus. This happens because the lens has to focus closer to its closest focus point which translates to distant elements falling out of the range of focus. The same principal holds true given the relationship of the distance of the subject from the background. If the subject and background are close to each other, then the proximity of all elements near and the lens will see everything in fairly sharp detail. Conversely, if the subject is moved far away from the background, the lens isn