473,769 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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
Jul 20 '05 #1
5 18648
Chandler wrote:
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.


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
Jul 20 '05 #2
On Tue, 28 Sep 2004 14:52:35 -0700, Chandler wrote:
I have a div with a background image. ..
I don't see it. URL?
..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.


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
Jul 20 '05 #3


Andrew Thompson wrote:

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


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

Thanks,
AC
Jul 20 '05 #4
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
Jul 20 '05 #5
David Dorward wrote:
Chandler wrote:

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.

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


Good article here:

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

--
Mark.
http://tranchant.plus.com/
Jul 20 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
42496
by: day | last post by:
I'm trying to use a non-scrolling background image within a div (the non-scrolling part is a "nice-to-have" vs a "have to have"). The style for that is: <div style="height=400px; background-image:url(bgrd-foo.jpg); background-position: center top; background-repeat:no-repeat; background-attachment: fixed;">
9
1494
by: hrschp | last post by:
Hi, as far as I know this always worked for a simple webpage up till a few days ago BODY { background-color: white; background-image: url(img/footer.gif); background-repeat: no-repeat; background-position: bottom left;
21
62857
by: tradmusic.com | last post by:
Hi, We have the following in our stylesheet, which acts as a page header: #homepageheader { left: 0px; top: 0px; right: 0px; height: 183px; background-image: url(graphics/header-salmoninbucket.jpg); background-repeat: no-repeat; background-color: #B6C7B6; } When you print, however, this doesn't appear.
5
20157
by: 3Dfelix | last post by:
I have a problem when using a Master page file in diferent aspx files. Some of this aspx are in different places. I have see that the problem is with styles definition on master file, when use "background-image". In some aspx files this background image are lost. for example: background-image:url('../App_Themes/images/image2.gif '); Any solution for this?
3
1436
by: rvanwaarden | last post by:
Hi All, I am relatively new to this game and I am running up against a problem trying to change the background image in my table. The idea is that when you click on the link, the javascript will change the table background. The table code looks like this <table id="tableVert" style="margin-left: auto; margin-right: auto; text-align: left; width: 100%; height: 500px; background-image: url();" border="0" cellpadding="0" cellspacing="0"> ...
16
4937
by: stevedude | last post by:
CSS newbie again. I have a problem trying to get coffee mug images within anchor tags to center with my link text for a vertical list menu. If I use the horizontal/vertical properties of "background" or "background-image", the positioning only works with specifying pixels. If I specify the vertical position in pixels, the image gets cut-off at the bottom. I don't know what to do and would appreciate anyone's help. Specifically the code...
3
4386
by: vartana | last post by:
I will be getting the background url dynamically using ajax and html. I have set an id=boxFooter_002 to my div and have .boxFooter_002{position:absolute;right:0px;width:12px;height:12px;background-image:none;filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='images/DOG.png', sizingMethod='fixed');} html>body .boxFooter_002{background:url('images/DOG.png') transparent repeat-x 0px 0px;} now the thing is i will need to...
2
14074
by: thephatp | last post by:
I'm having a problem with IE rendering correctly. I'm experimenting with using all div's in my pages now, and I'm not very familiar with the quirks of IE. I have created a sample page, and I'm really confused as to what is going on in IE. FF renders the page exactly as I expect. IE renders the page with everything in the correct location, but it seems to double the background image for a sub-div section that is moved up using a negative...
1
2210
by: farrukhm | last post by:
Hi There, I just want to know that either it is possible to set height/width of div/li etc according to width and height of their background image automatically? For example if i set the background 40 x 40 image. Div height width should automatically become 40 x 40.
0
10223
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10000
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9866
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3571
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.