Solved

Max height in IE6

Posted on 2011-03-24
3
310 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
Comment Utility
0
 
LVL 2

Assisted Solution

by:B_L_A_I_Z_E
B_L_A_I_Z_E earned 167 total points
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
jquery, html5 UI 1 45
Column Spacing 3 33
ASP.Net Session State alternatives 3 25
CSS help matching specific span class 2 20
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
In this tutorial viewers will learn how to style a decorative dropcap for the first letter in a paragraph using CSS. In CSS, create a new paragraph class by typing "p.fancy": Then, to style only the first letter of the first sentence, include the ps…

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now