?
Solved

Max height in IE6

Posted on 2011-03-24
3
Medium Priority
?
365 Views
Last Modified: 2012-06-21
How do you perform max height in IE6?
0
Comment
Question by:PagodNaUtak
3 Comments
 
LVL 40

Accepted Solution

by:
Gurvinder Pal Singh earned 668 total points
ID: 35205398
0
 
LVL 2

Assisted Solution

by:B_L_A_I_Z_E
B_L_A_I_Z_E earned 668 total points
ID: 35205405
Unfortunately, the only ways to achieve the max-height effect in IE6 are by using IE-specific CSS expressions, which are the equivalent of running JavaScript in a stylesheet, or by using JavaScript itself. Of the two, I recommend using the JavaScript solution as CSS expressions are expensive in terms of processing power and can cause the browser to crash. Both solutions will not function if JavaScript is disabled. Note that this solution is for IE6 only as all other browsers support max-height.

JavaScript

//Plain JavaScript, change the ID and dimensions to suit your code.
var container = document.getElementById('container');
container.style.height = (container.scrollHeight > 199) ? "200px" : "auto";

//An alternative function. Note: for dynamic resizing, attach to the window resize event
function setMaxHeight(elementId, height){
      var container = document.getElementById(elementId);
      container.style.height = (container.scrollHeight > (height - 1)) ? height + "px" : "auto";
}

//Example usage
setMaxHeight('container1', 200);
setMaxHeight('container2', 500);

   1. //Plain JavaScript, change the ID and dimensions to suit your code.
   2. var container = document.getElementById('container');
   3. container.style.height = (container.scrollHeight > 199) ? "200px" : "auto";
   4.
   5. //An alternative function. Note: for dynamic resizing, attach to the window resize event
   6. function setMaxHeight(elementId, height){
   7. var container = document.getElementById(elementId);
   8. container.style.height = (container.scrollHeight > (height - 1)) ? height + "px" : "auto";
   9. }
  10.
  11. //Example usage
  12. setMaxHeight('container1', 200);
  13. setMaxHeight('container2', 500);

Source: http://www.virtuosimedia.com/dev/css/ultimate-ie6-cheatsheet-how-to-fix-25-internet-explorer-6-bugs#max-height
0
 
LVL 13

Assisted Solution

by:stergium
stergium earned 664 total points
ID: 35205413
hello.
according to this http://msdn.microsoft.com/en-us/library/cc351024%28v=vs.85%29.aspx
you cannot! i am not aware of a workaround for it
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

As a result of several questions about how to use Bootstrap I thought it would be a good idea to write down the development aspect of creating a Bootstrapped website in as little time as possible. Part 1 of this article will only concentrate on g…
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…
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.…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
Suggested Courses
Course of the Month17 days, 7 hours left to enroll

864 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