473,803 Members | 3,625 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

min-height current wisdom

I need to set a minimum height for a div, yet have it expand with the
contents.

I have this from 2005:

<style type="text/css">
div{
height: 12px;
background-color: red;
1px solid black;min-height:12px
}

html>body div{
height: auto; /* for not-IE */
}
</style>

<div>one<br>two </div>
<br>
<div></div>

That works in my Firefox 2.0, Opera 9 and IE6 win XP.

Is that still the current best wisdom on this task? This still works
in IE7?

Jeff
Mar 20 '08 #1
4 1977
In article <13************ *@corp.supernew s.com>,
Jeff <jeff@spam_me_n ot.comwrote:
John Hosking wrote:
[snip]
>
Is there a "solution" to the div min height issue? What I actually
have is rows of different colored divs (in a table) with varying number
of lines in them. If I don't set a height I don't have a color sample.
If I set a height then the text might flow below the div. I don't want
to stuff &nbsp;'s in them.
I had thought that IE7 had implemented min-height? IIRC, it does
have min-width and max-width implemented, although you have to be
sure IE7 doesn't stumble into quirks mode...
Mar 20 '08 #2
Jeff wrote:
>
>>I need to set a minimum height for a div, yet have it expand with the
contents.

What I actually
have is rows of different colored divs (in a table) with varying number
of lines in them.
OK...
If I don't set a height I don't have a color sample.
Sounds like you decided on a solution (min-height) without fully
describing the problem, hence you may be fixing the wrong thing.

Post a URL, or at least a mockup showing your data in context. Then we
may be able to show you a better way to approach it.

--
Berg
Mar 20 '08 #3
David Stone wrote:
In article <13************ *@corp.supernew s.com>,
Jeff <jeff@spam_me_n ot.comwrote:
>John Hosking wrote:
[snip]
> Is there a "solution" to the div min height issue? What I actually
have is rows of different colored divs (in a table) with varying number
of lines in them. If I don't set a height I don't have a color sample.
If I set a height then the text might flow below the div. I don't want
to stuff &nbsp;'s in them.

I had thought that IE7 had implemented min-height? IIRC, it does
have min-width and max-width implemented, although you have to be
sure IE7 doesn't stumble into quirks mode...

I found this, circa 2006:

http://www.dustindiaz.com/min-height-fast-hack/

selector {
min-height:500px;
height:auto !important;
height:500px;
}

That supposedly worked in IE7.

Jeff
Mar 20 '08 #4
Bergamot wrote:
Jeff wrote:
>>>I need to set a minimum height for a div, yet have it expand with the
contents.
What I actually
have is rows of different colored divs (in a table) with varying number
of lines in them.

OK...
>If I don't set a height I don't have a color sample.

Sounds like you decided on a solution (min-height) without fully
describing the problem, hence you may be fixing the wrong thing.

Post a URL, or at least a mockup showing your data in context. Then we
may be able to show you a better way to approach it.
It's my old color styler that I posted a month ago. If you don't
remember it, I'll post it without live data in it.

Jeff
Mar 20 '08 #5

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

Similar topics

3
1670
by: Claudio Grondi | last post by:
Trying to understand the outcome of the recent thread (called later reference thread): "Speed quirk: redundant line gives six-fold speedup" I have put following piece of Python code together: class PythonObject_class: pass PythonObject_class_instanceA = PythonObject_class()
3
6738
by: Ker | last post by:
I have a query that works great. It gives me the min for multiple fields. Within this query, I also need to get the max of some fields too. I currently have output of Date Name Min Start 9/1/03 Walker Rhines 7:00AM I also need Max such as Max End 3:00PM
5
2338
by: kevinjouco | last post by:
Hello Have searched the group for a solution to the following problem without success: Table 1 has Ref No (No Duplicates) & Min Max Value Fields ie Ref No 1 Min 1 Max 10 Ref No 2 Min 11 Max 20 etc Table 2 is linked by Ref No (Allows Duplicates) & Recorded Value
5
1802
Min
by: Gregc. | last post by:
Hi I am trying to find the min of a list of numbers. For example, if a user enters 10 numbers 1,2,3,4,5,6,7,8,9,9 then the min would be 1. I've looked as past posts on the topic, and there was one that mentioned macro's. Could someone explain how do macro's (if at all) work within the C programming environment. Thanks
4
4718
by: MRAB | last post by:
Hi, Some time after reading about Python 2.5 and how the built-in functions 'min' and 'max' will be getting a new 'key' argument, I wondered how they would treat those cases where the keys were the same, for example: L = print min(L, key = len), max(L, key = len) The result is:
4
3523
by: jaip26 | last post by:
All, I came across a strange situation in my query. Basically here is the result of my query. col1 col2 col3 col4 col5 col6 col7 -------------------------------------------------------------------------------------------------- Jay 4.5 NULL 4.5 NULL 3.9 'AD' Jay 3.9 'AD' 5.9 'D' 4.5 NULL
11
5036
by: lovecreatesbea... | last post by:
#define MIN(x, y) ((x)<(y) ? (x):(y)) Can a version without conditional operator of MIN macro be written?
4
13445
by: BoscoPippa | last post by:
Hi all, I'm a rank beginner to C++ and programming in general. I'm in week 6 of my first course, and we have an assignment I'm having a little trouble with. If it matters, we're using standard (?) C++ in our class, not ANSI/ISO. Anyway.... The problem is to do the following: 1. Ask for input of up to 10 numbers 2. Return the number of entries, the total, the average, the minimum and maximum values 3. Allow user to enter a...
19
29264
by: Eugeny Myunster | last post by:
I know, only simple one: #include <stdio.h> int main() { int min=0,max=0,i,arr; for(i=0;i<12;i++) arr=rand()%31-10; for(i=0;i<12;i++)
16
3873
by: Peng Yu | last post by:
Hi, I'm wondering if there is a min function (in boost, maybe?) that accepts any number of arguments? std::min only accepts two arguments. If I want to get the minimum number out of many, I have use std::min many times, which is not convenient. Thanks, Peng
0
10546
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
10292
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
10068
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...
0
9121
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6841
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
5498
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
5627
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3796
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.