HTML and CSS Reference
In-Depth Information
ic
value is most commonly overwritten with a
relative
or
absolute
value, which
we'll examine next.
Relative Positioning
The
relative
value for the
position
property allows elements to appear within the
normal flow a page, leaving space for an element as intended while not allowing other ele-
ments to flow around it; however, it also allows an element's display position to be mod-
ified with the box offset properties. For example, consider the following HTML and CSS
(see
Figure 5.11
):
HTML
1.
<div>...</div>
2.
<div class="offset">...</div>
3.
<div>...</div>
CSS
1.
div {
2.
border: 1px solid #949599;
3.
height: 200px;
4.
width: 200px;
5.
}
6.
.offset {
7.
left: 20px;
8.
position: relative;
9.
top: 20px;
10.
}
Search WWH ::
Custom Search