HTML and CSS Reference
In-Depth Information
relative positioning, elements are positioned relative to their position in normal flow. With
absolute positioning, the element is positioned relative to its first parent element. You will
start with an image placed on a page inside a div element. Figure 4-26 shows this element in
static flow.
FIGURE 4-26 An image at its default position inside a div element
The left and right properties start their measurements from the outer-most edge of the
box. For the exam, keep in mind that if there are margins or padding specified, this will
influence the position of the object as well.
By applying the following style to the image, you are able to reposition the image inside
the div element. The output of this is shown in Figure 4-27.
img {
position: fixed;
left: 25px;
top: 25px;
FIGURE 4-27 An image repositioned by setting the top and left CSS properties
Search WWH ::

Custom Search