Training Guide: Programming in HTML5 with JavaScript and CSS3 Ebook

(Nora) #1

184 CHAPTER 4 Getting started with CSS3


left: 5px;
}

With the position set to fixed, div5 is positioned relative to the browser window, as shown
in Figure 4-16.

FIGURE 4-16 etting the position to fixed to set the positioning relative to the browser windowS

More absolute positioning
Return now to absolute positioning. You can set the position, size, and location of div3, div4,
and div5. The following is the contents of the default.css file.
p {
margin: 0px;
}

div {
border: solid;
border-color: black;
}

#div1 {
background-color: yellow;
}

#div2 {
background-color: cyan;
position: absolute;
top: 15px;
Free download pdf