473,385 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Layered DIVs & Background Images

Hi -

So, I had this working perfectly, then had a small crash (the transmitter for my wireless mouse occassionally freaks out my MacBook Pro) and when I rebooted and opened up my file the two layered DIVs I had were no longer showing up correctly. I had this going fine for several hours -- it wasn't a happy accident I forgot to save. I'm totally mystified on this one.

Here's the summary: I want #container to be under #containerbranch, so that the background image of #containerbranch will be laying on top of the background image of #container. The property I was playing with when i had the crash was the width of the #maincontainer div in the CSS file. But, I'm not really sure why that would affect the DIVs ability to layer?

It is very possible that I changed something by accident, but I have been over and over this and I can find anything.

I would so greatly appreciate any help anyone could offer.

I've tried playing with the z-index and the positing of both the DIVs that I am trying to layer to no avail. I'm really not sure how the float property would be in play here. I tried it both ways - when the DIV that should be in front (#containerbranch) is float:left, it obscures #container. I would think that neither DIV would need to have a float set since they are both at 100% width and height?

All the best and I hope everyone is having a great night. I do apologize if this is a very simple problem and I am just missing something obvious.

(I'm testing both in Dreamweaver as well as Safari for Mac and Firefox for Mac.)

Thank you!
tt



Here's the full CSS file, which has been validated by W3C validator:

Expand|Select|Wrap|Line Numbers
  1. @charset "UTF-8";
  2. body {
  3. background-color : #fffee3;
  4. font-family : "Trebuchet MS", Tahoma, Verdana;
  5. font-size : 0.9em;
  6. height : 100%;
  7. }
  8.  
  9. #maincontainer {
  10. width : 750px;
  11. height : 100%;
  12. padding : 0;
  13. margin-left : auto;
  14. margin-right : auto;
  15. }
  16.  
  17. #header {
  18. width : 100%;
  19. height : auto;
  20. padding : 0;
  21. margin : 0;
  22. }
  23.  
  24. #container {
  25. width : 100%;
  26. height : 100%;
  27. padding : 0;
  28. margin : 0;
  29. background-image : url(_images/right_bg_img.png);
  30. background-repeat : repeat-y;
  31. background-position : right 0%;
  32. background-color : #aec580;
  33. }
  34.  
  35. #containerbranch {
  36. width : 100%;
  37. height : 100%;
  38. padding : 0;
  39. margin : 0;
  40. background-image : url(_images/right_branch.png);
  41. background-repeat : no-repeat;
  42. background-position : bottom right;
  43. position : relative;
  44. z-index : 2;
  45. }
  46.  
  47. #subheader {
  48. width : 100%;
  49. float : left;
  50. margin-top : 0;
  51. }
  52.  
  53. #leftsidebar {
  54. width : 100px;
  55. float : left;
  56. margin : 0;
  57. padding : 0;
  58. }
  59.  
  60. #content {
  61. width : 340px;
  62. float : left;
  63. margin-right : 0;
  64. }
  65.  
  66. #footer {
  67. width : 100%;
  68. height : auto;
  69. padding-top : 3px;
  70. padding-bottom : 1px;
  71. background-color : #746f77;
  72. font-size : 0.7em;
  73. text-align : center;
  74. color : #fffee3;
  75. clear : both;
  76. }
  77.  
  78. .massageimg {
  79. position : relative;
  80. left : 60px;
  81. }
And the HTML file:

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5. <title>Untitled Document</title>
  6. <link href="main.css" rel="stylesheet" type="text/css" />
  7. <!--[if lt IE 7.]>
  8. <script defer type="text/javascript" src="pngfix.js"></script>
  9. <link href="oldIE.css" rel="stylesheet" type="text/css" />
  10. <![endif]-->
  11. </head>
  12. <body>
  13. <div id="maincontainer">
  14.  
  15. <div id="header"><img style="position:relative; left: 10px; z-index: 4;" src="_images/head_robinname.gif" alt="Robin Hollister" /></div>
  16.   <div id="container">
  17.    <div id="containerbranch">
  18.           <div id="subheader">
  19.               <img src="_images/head_massage.gif" alt="Massage Therapy - LMBT# 6540" width="351" height="38" class="massageimg" />
  20.         </div>
  21.  
  22.         <div id="leftsidebar">
  23.           <p>&nbsp;</p>
  24.           <p>&nbsp;</p>
  25.           <p>&nbsp;</p>
  26.           <p>&nbsp;</p>
  27.           <p>LEFT SIDE BAR</p>
  28.         </div>
  29.  
  30.         <div id="content">
  31.  
  32.           <p>Quisque facilisis erat a dui. Nam malesuada ornare dolor. Cras gravida,
  33.             diam sit amet rhoncus ornare, erat elit consectetuer erat, id egestas
  34.             pede nibh eget odio. Proin tincidunt, velit vel porta elementum,
  35.             magna diam molestie sapien, non aliquet massa pede eu diam. Aliquam
  36.             iaculis. Fusce et ipsum et nulla tristique facilisis. Donec eget
  37.             sem sit amet ligula viverra gravida. Etiam vehicula urna vel turpis.
  38.             Suspendisse sagittis ante a urna. Morbi a est quis orci consequat
  39.             rutrum. Nullam egestas feugiat felis. Integer adipiscing semper ligula.
  40.             Nunc molestie, nisl sit amet cursus convallis, sapien lectus pretium
  41.             metus, vitae pretium enim wisi id lectus.</p>
  42.           <p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Morbi
  43.             commodo, ipsum sed pharetra gravida, orci magna rhoncus neque, id
  44.             pulvinar odio lorem non turpis. Nullam sit amet enim. Suspendisse
  45.             id velit vitae ligula volutpat condimentum. Aliquam erat volutpat.
  46.             Sed quis velit. Nulla facilisi. Nulla libero. Vivamus pharetra posuere
  47.             sapien. Nam consectetuer. Sed aliquam, nunc eget euismod ullamcorper,
  48.             lectus nunc ullamcorper orci, fermentum bibendum enim nibh eget ipsum.
  49.             Donec porttitor ligula eu dolor. Maecenas vitae nulla consequat libero
  50.             cursus venenatis. Nam magna enim, accumsan eu, blandit sed, blandit
  51.           a, eros.</p>
  52.           <p>Quisque facilisis erat a dui. Nam malesuada ornare dolor. Cras gravida,
  53.             diam sit amet rhoncus ornare, erat elit consectetuer erat, id egestas
  54.             pede nibh eget odio. Proin tincidunt, velit vel porta elementum,
  55.             magna diam molestie sapien, non aliquet massa pede eu diam. Aliquam
  56.             iaculis. Fusce et ipsum et nulla tristique facilisis. Donec eget
  57.             sem sit amet ligula viverra gravida. Etiam vehicula urna vel turpis.
  58.             Suspendisse sagittis ante a urna. Morbi a est quis orci consequat
  59.             rutrum. Nullam egestas feugiat felis. Integer adipiscing semper ligula.
  60.             Nunc molestie, nisl sit amet cursus convallis, sapien lectus pretium
  61.             metus, vitae pretium enim wisi id lectus.</p>
  62.     </div>
  63.    </div>
  64.   </div>
  65.  
  66.   <div id="footer"><?php include("_source/footer.php"); ?></div>
  67. </div>
  68. </body>
  69. </html>
Jan 28 '08 #1
2 2721
drhowarddrfine
7,435 Expert 4TB
Add to your css:
html{height:100%}

See if that helps but I don't have time to see if that's what you need right now.
Jan 28 '08 #2
Thank you Howard!

I think that did it! I'm not sure why it was working earlier when I didn't have this in there, but it's working now!

Many many thanks!
tt



Add to your css:
html{height:100%}

See if that helps but I don't have time to see if that's what you need right now.
Jan 28 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Aaron | last post by:
Hi, I'm trying to use style sheets instead of tables for layout, but I'm not sure on how to do something... I have a div (100% width) containing 3 other divs. Each needs to be lined up next to...
13
by: Aaron | last post by:
Hi, In the following code, everything looks fine on Explorer, but on Netscape there is a large white gap between the 'top' section and the 'bottom menu' section. I've set the style 'div img...
4
by: Aaron | last post by:
I have the following divs: <div style="background-image: url(images/house_01.jpg); width: 249px; height: 346px;"></div> <div style="background-image: url(images/house_02.jpg); width: 251px;...
0
by: Jeb Hunter | last post by:
Well, how can I describe this succinctly? I have a page with DIVs that us background images to produce a border effect. It works perfectly well, but I want to make up (for now) 3 different...
7
by: arupfrancis | last post by:
Hi, I am trying to create a colored box using background images. I am able to do it easily using tables but doing it in divs is proving to be an issue. Moreover IE and Mozilla also seems to be...
1
by: judacris | last post by:
I've seen the threads here about molding 2 divs in a centered fashion. but I can't seem to solve this thing. my blogger blog is functioning well on my site for now, but the blog feed (left) and...
1
by: cma6 | last post by:
I have a page which uses tables for layout http://www.vintagetextile.com/1920s_to_1930s.htm The checkerboard pattern is achieved with this markup: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML...
21
by: daydream | last post by:
yeah i need some help(such a common line) ,i have a menu and each link has its own div respectively and yeah obviously when u click the link the div shows, the problem is i would like each div to...
1
by: musaligari | last post by:
hi all, when i am using div tags, i am getting gaps between the divs. please refer the code which i have written. please find free to help me out. /******************* CSS...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.