First, let's take a look at the demo (the background image is automatically scaled when the browser window size is changed)
Code Parsing
Main HTML code
<Div>
</Div>
<Div id = "fixed">
<P> the background image is always 100% x 100% (Body Size). But it only works with a 100% x 100% html/body. </P>
</Div>
<Div id = "scroller">
<Div id = "content">
Document content .....
</Div>
</Div>
As you can see from the code above, the image, the small text on the left, the main content of the document is three Div distribution, is the main three frameworks.
Next, let's take a look at the relevant CSS code.
HTML, body {margin: 0; padding: 0; width: 100%; Height: 100%; overflow: hidden ;}
/* Set the global style of HTML and body labels, with no internal and external spacing and full length and width of 100%. When overflow occurs, the system automatically extends to hide the internal scroll bar */
Body {font-family: verdana, Arial, sans-serif; font-size: 76% ;}
/* Set the global font and size */
# Background {position: absolute; Z-index: 1; width: 100%; Height: 100% ;}
/* Place the DIV of the image to be absolutely positioned. The zcoordinate is 1 and the automatic length and width */
# Scroller {position: absolute; width: 100%; Height: 100%; top: 0; left: 0; overflow: auto; Z-index: 2 ;}
/* The External Frame of the main content is also full 100% long and wide. Positioning occupies the full screen. The zcoordinate is a layer higher than the image Div, so it is above the image, and when the DIV content exceeds the range, the scroll bar is displayed */
# Content {padding: 5px 300px 20px 200px ;}
P {Line-Height: 1.8em; letter-Spacing: 0.1em; text-align: justify ;}
/* Set the style of the content. With left and right internal patches, the left and right scroll bars are not displayed */
# Fixed {position: absolute; top: 25px; left: 10px; width: 150px; Z-index: 10; color: #567; Border: 1px solid #000; padding: 10px ;}
/* Set the DIV in the upper left corner. The zcoordinate is 10.