CSS question: Using height/width at 100% with fixed-width borders/margin/padding

Discussion in 'HTML' started by cera, Aug 17, 2007.

  1. cera

    cera Guest

    I am trying to create a block where I can use height and width at
    100%, with the exception of a small 6-pixel border. An example that
    stretches to fit the page is here, but it does not include this border/
    margin/padding that needs to be added. Once I try to add a border,
    margin, or padding .. it starts to scroll. Using overflow: hidden in
    the body just clips the right and bottom sides.

    I would appreciate any suggestions on how to resolve this issue.
    Thank you, -Chris

    div.main-body {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 100%;
    height: 100%;
    background-color: blue;
    padding: 0px;
    margin: 0px;
    }

    I have an html snippet here:
    http://cera.us/css-test.html
    cera, Aug 17, 2007
    #1
    1. Advertising

  2. cera

    Neredbojias Guest

    Well bust mah britches and call me cheeky, on Fri, 17 Aug 2007 20:54:11 GMT
    cera scribed:

    > I am trying to create a block where I can use height and width at
    > 100%, with the exception of a small 6-pixel border. An example that
    > stretches to fit the page is here, but it does not include this border/
    > margin/padding that needs to be added. Once I try to add a border,
    > margin, or padding .. it starts to scroll. Using overflow: hidden in
    > the body just clips the right and bottom sides.
    >
    > I would appreciate any suggestions on how to resolve this issue.
    > Thank you, -Chris
    >
    > div.main-body {
    > position: absolute;
    > top: 0px;
    > left: 0px;
    > width: 100%;
    > height: 100%;
    > background-color: blue;
    > padding: 0px;
    > margin: 0px;
    > }
    >
    > I have an html snippet here:
    > http://cera.us/css-test.html


    Your snippet doesn't work at all in ie6, and you didn't close the <div>.

    What I usually do is put a div in a div. There are some particulars to
    this, but I have no idea of what you are trying to accomplish.

    --
    Neredbojias
    Half lies are worth twice as much as whole lies.
    Neredbojias, Aug 18, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Not4u
    Replies:
    9
    Views:
    1,026
    Not4u
    Feb 27, 2004
  2. charlbury
    Replies:
    26
    Views:
    3,531
    Andy Dingley
    Nov 19, 2007
  3. Bernd Meier
    Replies:
    6
    Views:
    500
    GTalbot
    Jan 14, 2008
  4. Ciaran
    Replies:
    14
    Views:
    1,724
    dorayme
    Jun 27, 2009
  5. Replies:
    5
    Views:
    864
Loading...

Share This Page