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 3 of 3
  1. #1
    New Coder
    Join Date
    Nov 2007
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need clever fix: Rendering sibling divs, one defined in px one in %

    I have prepared an example with the explanation of what I am trying to do with it here: http://kc.jorsek.com/test_codelet.php

  • #2
    New Coder
    Join Date
    Sep 2007
    Posts
    34
    Thanks
    0
    Thanked 7 Times in 7 Posts
    <!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=utf-8" />
    <title>Untitled Document</title>
    <style type="text/css">
    body {
    width:100%;
    }

    #redBorder {
    border: 2px solid #FF0000;
    width:500px;
    }

    #blueBorder {
    border: 2px solid #0099FF;
    height:50px;
    margin:1px;
    }

    #greenBorder {
    border: 2px solid #339966;
    margin:1px;
    height:100%;
    }
    </style>
    </head>

    <body>
    <div id="redBorder">
    <div id="blueBorder"></div>
    <div id="greenBorder">
    This won't work when you specify height for "redBorder" in px
    </div>
    </div>
    </body>
    </html>

    regards,
    rams

  • #3
    The Apostate Apostropartheid's Avatar
    Join Date
    Oct 2007
    Posts
    3,215
    Thanks
    16
    Thanked 265 Times in 263 Posts
    On green border, why don't you specify a minus margin? I didn't look at source--try reading a menu in Spanish--but that's how I would do it, as it takes off space instead.


  •  

    Posting Permissions

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