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

C

cera

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
 
N

Neredbojias

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,570
Members
45,045
Latest member
DRCM

Latest Threads

Top