Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 21st, 2005, 12:53 AM
Chandler
Guest
 
Posts: n/a
Default Minimum div height to preserve background image

Hi,

I have a div with a background image. The height of the div needs to
stretch to accomodate any changes of internal content, but needs to
remain at least 400px so that the background image is showing at all
times. I can't set the height to 400px, because it will prevent any of
it's other styles from being displayed if the content's height exceeds
400px. I also can't set the height to auto, since the content might be
much be less than 400px, thereby causing the background-image to be cut
off. Any ideas how to approach this?

Thanks,
AC
  #2  
Old July 21st, 2005, 12:53 AM
David Dorward
Guest
 
Posts: n/a
Default Re: Minimum div height to preserve background image

Chandler wrote:
[color=blue]
> I have a div with a background image. The height of the div needs to
> stretch to accomodate any changes of internal content, but needs to
> remain at least 400px so that the background image is showing at all
> times.[/color]

In a world where most people used a browser which supported min-height, this
would be easy:

#foo {
min-height: 400px;
}

Thankfully, this isn't too difficult to work around. Internet Explorer has a
big (shock) in which is treats the height property of elements with
overflow: visible (the default) as min-height.

So we get:

#foo {
height: 400px; /* for IE */
min-height: 400px; /* for not-IE */
}

html>body #foo {
height: auto; /* for not-IE */
}

That should, IIRC, do the trick.

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
  #3  
Old July 21st, 2005, 12:53 AM
Andrew Thompson
Guest
 
Posts: n/a
Default Re: Minimum div height to preserve background image

On Tue, 28 Sep 2004 14:52:35 -0700, Chandler wrote:
[color=blue]
> I have a div with a background image. ..[/color]

I don't see it. URL?
[color=blue]
> ..The height of the div needs to
> stretch to accomodate any changes of internal content, but needs to
> remain at least 400px so that the background image is showing at all
> times.[/color]

If the image is so important that it must be "showing at
all times", perhaps it should be in an image element.

You are not 'crossing the boundaries' and putting content
in your styles are you?

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.lensescapes.com/ Images that escape the mundane
  #4  
Old July 21st, 2005, 12:53 AM
Chandler
Guest
 
Posts: n/a
Default Re: Minimum div height to preserve background image



Andrew Thompson wrote:[color=blue]
>
> You are not 'crossing the boundaries' and putting content
> in your styles are you?
>[/color]

No, the background image is pretty much a large watermark of the
business logo which works best as such, not an image.

Thanks,
AC
  #5  
Old July 21st, 2005, 12:53 AM
Chandler
Guest
 
Posts: n/a
Default Re: Minimum div height to preserve background image

Works great..thanks a million.

Hope the next version of IE recognizes "min-height" (or at least if it
doesn't, it doesn't start recognizing "html>body #foo"!!).

AC
  #6  
Old July 21st, 2005, 12:53 AM
Mark Tranchant
Guest
 
Posts: n/a
Default Re: Minimum div height to preserve background image

David Dorward wrote:[color=blue]
> Chandler wrote:
>
>[color=green]
>>I have a div with a background image. The height of the div needs to
>>stretch to accomodate any changes of internal content, but needs to
>>remain at least 400px so that the background image is showing at all
>>times.[/color]
>
>
> In a world where most people used a browser which supported min-height, this
> would be easy:[/color]

Good article here:

http://www.mezzoblue.com/archives/20...t_fi/index.php

--
Mark.
http://tranchant.plus.com/
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles