Solved

Bg Image not Showing in Container Div

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Creating a CSS block that only applies to printing By default, all of your CSS applies to every possible view of your page - whether on screen, printed, landscape, touch-screen, or whatever.  You can, however, add CSS that only applies under certai…
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
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.…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

785 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