The first problem is that I would like to display some text on top of an image within the header. I've tried using absolute positioning to specify where the phone number should appear in relation to the parent div (#header). However the text appears to be positioned in relation to the screen, not the parent div. Key bits of code as follows:
-----------------
Expand|Select|Wrap|Line Numbers
- <body>
- <!--To provide a white box background to the core page-->
- <div id="container">
- <div id="header">
- <img src="images\image1.jpg" alt="image1" />
- <img src="images\image2.gif" alt="image2" />
- <img src="images\image3.jpg" alt="image3" />
- <div id="headertext">
- <p>text to go over image in header</p>
- </div>
- <div id="topnav">
- <ul>
- <li><a href="index.html">Home</a></li>
- <li><a href="tips.html">Tips</a></li>
- <li><a href="contact.html">Contact</a></li>
- </ul>
- </div>
- <!--end of "header" div-->
- </div>
- <!--various other divs contained by a "content" div and a "footer" div-->
- <!--end of "container" div-->
- </div>
- </body>
----------------------
Expand|Select|Wrap|Line Numbers
- body {
- color: #000000;
- background-color: #EAEAEA;
- font-family: Arial, sans-serif;
- font-size: 0.8em;
- /* to make the container centre in IE 5 and lower */
- text-align: center;
- }
- #container {
- background-color: #FFFFFF;
- width: 730px;
- /* to re-set text to left alignment after implementing IE fix to body above */
- text-align: left;
- /* to centre the container for browsers other than IE 5 and lower */
- margin-left: auto;
- margin-right: auto;
- }
- #header {
- width:100%;
- }
- #headertext {
- position: absolute;
- top: 35px;
- right: 35px;
- color: #FFFFFF;
- font-weight: bold;
- font-size: 1.5em;
- }
- #topnav {
- width: 100%;
- background-color: #EAEA00;
- margin-left: 0;
- padding-top: 3px;
- padding-bottom: 3px;
- }
- #topnav ul li {
- display: inline;
- list-style-type: none;
- padding: 3px;
- }
You can probably see I still haven't sorted out how to distribute my menu items across the page, and there seem to be extraneous things in there. For example, I'm not sure why I should need to specify a width of 100% for #header and #topnav in order to get them to stay within the container div; but that appears to be the case. Also I tried using a class (assigned to the para) instead of a whole separate div in order to position the headertext, but that didn't work either and divs seem to be the preferred mode, so I've stuck with that.
Those confusions aside, the key thing is that I don't understand why the headertext's absolute positioning is relative to the screen, rather than relative to the #container (or the #header). Bear in mind that I want the design to work for various screen resolutions (so I can't just adjust the values of the absolute positioning to get it into the right spot).
Hope that all makes sense!