Solved

Max height in IE6

Posted on 2011-03-24
3
347 Views
Last Modified: 2012-06-21
How do you perform max height in IE6?
0
Comment
Question by:PagodNaUtak
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

So you have coded your own WordPress plugin and now you want to allow users to upload images to a folder in the plugin folder rather than the default media location? Follow along and this article will show you how to do just that!
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
In this tutorial viewers will learn how to position items using CSS's three positioning types Create a new HTML document with an internal stylesheet.: Create another div in CSS and name it Absolute : Type "position:absolute;" and "top:10px; left:50p…
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

697 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