Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Nov 2011
    Posts
    36
    Thanks
    6
    Thanked 0 Times in 0 Posts

    can't set div max-height in IE

    I have a div whose maximum height I'm setting as follows:

    div
    {
    max-height: 50px;
    overflow: hidden;
    }

    This makes it so that any content whose height spans beyond 50px will not be completely visible (i.e. it will overflow below the bottom border of the div where it will not be seen).

    This seems to work in Firefox but not in IE. In IE, the div still stretches beyond the height of 50px to make room for its contents such that everything is visible.

    How can I enforce the maximum height in IE?

  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    well max-height appears to be supported by ie7 and above, so perhaps you havent declared a proper doctype so IE is going into quirks mode and being.. well, itself.

  • Users who have thanked DanInMa for this post:

    gib65 (03-13-2012)

  • #3
    New Coder
    Join Date
    Nov 2011
    Posts
    36
    Thanks
    6
    Thanked 0 Times in 0 Posts
    My doctype is:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >

    But the problem all of a sudden fixed itself. So thanks anyway.

  • #4
    Registered User
    Join Date
    Jun 2011
    Posts
    1,063
    Thanks
    12
    Thanked 241 Times in 240 Posts
    If a problem just suddenly fixes itself, maybe it was because of the cache. If you place in the <head>:

    Code:
    <meta http-equiv="cache-control" content-no-cache" />
    I think this will avoid future problems for servers, but I'm not sure. It doesn't hurt to put it there, so might as well


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •