views:

106

answers:

3

I have a problem with displaying a set height in ie.

In my css I have set a height for my sidebar div as 2150px; which it displays fine in firefox but does not display the full height in ie.

How can I get ie to display the height I have set in ie?

Thanks in advance

The source code is below

#sidebar_newspr{
width:160px;
min-height:2150px; 
margin-top:1px; margin-right:2px;
border-right-style:solid; border-right-color:#900; border-right-width:1px;
float:left;
}
 #sidebar_newspr a{
 text-decoration:none;
 color:#FFF;
 font-size:12px; font-family:Verdana,Arial,Helvetica,sans-serif;
 }
 #sidebar_newspr a:hover{
 color:#900;
 }
+2  A: 

This is a bit of a shot in the dark because you didn't really specify which versions of IE you're testing it in. Nevertheless, min-height requires IE7 and IE8 to be operating in Standards Mode. To enable Standards Mode, you need to use a strict !DOCTYPE.

From the documentation:

In Internet Explorer 7, the min-height/max-height attributes apply to floating and absolutely positioned block, inline-block elements, and some intrinsic controls. They do not apply to non-replaced inline elements, such as table columns and row/column groups. (A "replaced" element has intrinsic dimensions, such as an img or textArea.)

In Internet Explorer 7, this property is enabled only under the strict !DOCTYPE.

min-height in IE6 applies only to th, td and tr elements.

Andy E
In IE6 height acts like min-height.
rebus
A: 

Try to use conditional comments:

<!--[if lt IE 9]> //will target IE less than version 9
        <link href="/directroy/IE.css" rel="Stylesheet" type="text/css"/>
<![endif]--> 

To your head tag and use this new stylesheet to define what you want IE to do.

#sidebar_newspr{
width:160px;
height:2150px; /*change to just height*/
margin-top:1px; margin-right:2px;
border-right-style:solid; border-right-color:#900; border-right-width:1px;
float:left;
}

You can also use more than one Conditional comments to target different versions of IE.

Like so:

<!--[if IE 8]> //will target only IE 8
        <link href="/directroy/IE.css" rel="Stylesheet" type="text/css"/>
<![endif]--> 

Then try to set your doctype to strict:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt;

Might work, if not then I'm sure someone else has another idea :)

Kyle Sevenoaks
A: 

Some versions of IE dislike min-height, I try to tend to avoid it if possible.

As a quick solution that wont weigh your page down like an IE only style, simply state height:2150px; min-height:2150px; Browsers that support min-height will take that, while the ones that don't support it will simply ignore it.

Erin