Positioning Elements AbsolutelyThe elements in your Web page generally flow in the order in which they appear. That is, if the img tag comes before the p, the image appears before the paragraph. You can take elements out of the normal flowand position them absolutelyby specifying their precise position with respect to the nearest positioned ancestor or to the body. Figure 11.30. Our photo is still sitting above the text in the photo_text div. We want to shift it down into the space that we've set aside in the left margin.
To position elements absolutely:
Figure 11.31. First we set the position for the photo_text class so that the photos will be positioned with respect to it (and not to the body). The negative left offset will pull the photo left and out of the photo_text box.
Figure 11.32. Wherever the photo_text class goes, the photo will be stuck to its left side. Remember that the text in photo_text does not move out of the way for the photo. We pushed it away by giving it a left margin of 110px on page 176.
Tips
|