Solved

Bg Image not Showing in Container Div

Posted on 2007-03-21
4
421 Views
Last Modified: 2008-02-01
Hi! I have a container-div with 2 divs inside it. The 2 divs are floated left and right. So what I get is 2 columns inside a container div. This is fine and works. What I want to do is add a bg image to the container to extend from top to bottom. In Firefox, this works just as expected, but in IE7, the bg image only shows at the top of the container-div and does not extend down.

Basically, what I want is background repeat-y, but IE displays it as if it were repeat-x.

Hope this makes sense...

I think I may be missing something as I've never come across this problem before ... ??
0
Comment
Question by:Julian Matz
  • 2
  • 2
4 Comments
 
LVL 21

Author Comment

by:Julian Matz
ID: 18768947
Ok, I was able to fix this by placing a non-breaking space at the bottom of the container div... I just find it strange that I never encountered this issue before... Maybe a bug in IE7 ??

<div id="main-content-wrapper">

<div id="mcL">
<h1>TITLE</h1>
<p>Text.................</p>
</div><!-- eof #mcL -->

<div id="mcR">
<h1>Featured Property</h1>
<p class="c"><img src="property/prop01.jpg" width="160" height="120" alt="Cyprus Property" /></p>
</div><!-- eof #mcR -->

<br class="clr" />

&nbsp;

</div><!-- eof #main-content-wrapper -->
0
 
LVL 1

Expert Comment

by:kiere
ID: 18771313
I am pretty sure this falls under the "Holly Hacks" for IE.  When using CSS with IE, you need to add a height: 1%; to any div with nested floats and a display: inline; to each div that is floated and has margins greater than zero:

So, if your container just has floats, but ike this:

#main-content-wrapper {
  height: 1%;
}

#mcL {
  display: inline;
}

#mcR {
  display: inline;
}

This article may help you with these IE problems:
http://www.maratz.com/blog/archives/2005/06/16/essentials-of-css-hacking-for-internet-explorer/

And this one:
http://www.communitymx.com/content/article.cfm?page=2&cid=C37E0

I find that IE 6 and 7 do things a little differently so I prefer using "conditional comments" to put my IE 6 and 7 patches (hacks) in different files so my "clean" CSS can live in my main CSS file.
0
 
LVL 1

Accepted Solution

by:
kiere earned 500 total points
ID: 18771338
Sorry, I clicked submit prematurely.  It should have read:

So, if your container just has nested floats, then use this:

#main-content-wrapper {
  height: 1%;
}

But, if your floats also have margins greater than zero, add this:

#mcL {
  display: inline;
}

#mcR {
  display: inline;
}
0
 
LVL 21

Author Comment

by:Julian Matz
ID: 18803217
Thanks, kiere. I haven't tested this any further yet, but I'm sure you're right. Thanks!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now