Solved

Bg Image not Showing in Container Div

Posted on 2007-03-21
4
453 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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Looking for magnifying glass wingding font 3 18
Make Line Items Look Good Over Mobile 2 83
Create tabs to show divs 9 35
styling bootstrap grid system with CSS 2 39
Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…

837 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