Solved

Max height in IE6

Posted on 2011-03-24
3
340 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:
gurvinder372 earned 167 total points
ID: 35205398
0
 
LVL 2

Assisted Solution

by:B_L_A_I_Z_E
B_L_A_I_Z_E earned 167 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 166 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem to refer to value 8 62
Save ms data to server side. 19 55
Add shadow behind div 5 25
VS 2015 is giving [No relevant source lines] 2 26
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
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 Micro Tutorial users will learn how to embed custom fonts into websites using @font-face in CSS Select a font: Ensure the EULA allows you to use @font-face: Download the font: Get the browser-compatible files you need: Edit your CSS       - Name …
In this tutorial viewers will learn how to style different bullet points for unordered lists in CSS. Begin with a normal unordered list; the default bullet point is a solid circle: In the CSS, create a defined class of unordered list by typing "ul.S…

856 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