SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    "auto" with fixed height

    Hi:

    I have a box which is used to show error (something like PayPal). Now, I have fixed the height of this box(48ox) so it shows image and the error message which is one line.

    But, then I encountered a problem where my error message has 4 lines and the box is still 48px.

    I changed it to auto
    height: auto;

    it worked for 4 lines. but the problem is when it's 1 line it doesn't show the image properly because it auto fits to one line and shows only half of the image.

    How can I include both auto and fixed error in the same class?

    With one line


    With more lines



    Thanks
    ---------------------------
    Errors = Improved Programming.
    My Site

  2. #2
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How about min-height?

    Use * html .classname and just apply height to replicate this in IE6.

  3. #3
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks but I am not sure what you mean.

    Can you please give me an example? My knowledge of CSS is not that deep.

    Thanks
    ---------------------------
    Errors = Improved Programming.
    My Site

  4. #4
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Got it from an example.
    thanks
    Code:
    /* for Internet Explorer */
    /*\*/
    * html .container {
    height: 8em;
    }
    /**/
    ---------------------------
    Errors = Improved Programming.
    My Site

  5. #5
    SitePoint Wizard bronze trophy DaveWoods's Avatar
    Join Date
    Dec 2004
    Location
    Derbyshire - UK
    Posts
    2,651
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not sure without looking it up but I think that'll be targetting IE5.2 on the mac which I personally ignore now anyway.

    Try something like this

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Min Height Example</title>
    <style type="text/css">
    * {
        padding: 0;
        margin: 0;
    }
    body {
        font-family: verdana, arial, helvetica, sans-serif;
        padding: 10px;
    }
    #container {
        padding: 10px;
        min-height: 80px;
        width: 280px;
        background-color: #CCC;
    }
    * html #container {
        height: 80px;
    }
    </style>
    </head>
    <body>
    <div id="container">
    <p>Here's some text</p>
    </div>
    </body>
    </html>
    Using min-height initially will allow all standards browsers that support it to expand.

    IE6 treats height as min-height anyway so the second rule targets just IE6

    Hope that helps.

  6. #6
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As Dave said, you don't need to worry about Mac-IE anymore. It's a dead browser - As Vinnie Garcia (vgarcia) says, let it stay dead.

  7. #7
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you all.

    It worked.
    ---------------------------
    Errors = Improved Programming.
    My Site


Bookmarks

Posting Permissions

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